Deploy GWT and HTML application - apache

I have a simple site, that uses just four HTML pages. One page has a <div id=main_container /> element. From the GWT application I use the RootPanel.get("main_container") to access that element. The GWT app uses GWT-RPC to connect to a server (written in java). My problem is how to test it on xampp, because if I compile the GWT app and upload the war files and put inside it the four HTML files, then I can access all of the pages except the one that contains the <div> element. I need some help here!

If you are using GWT-RPC, you also need an Application Server like jetty or tomcat. Apache alone is not enough.
If you are developing your app, there is no need for apache as you can run your whole web app in DevMode or just jetty.
In production what you want to do is set up Apache as a proxy to your web app running on jetty. Just to be clear, you cannot run a GWT app that also uses GWT-RPC on most shared host environments.

Related

Why ASP.NET Core web application does not serve static web assets when started from command line?

This title would be too long, but this is more isolated issue:
Why ASP.NET Core web application does not serve static web assets when started from command line and the ASPNETCORE_ENVIRONMENT is not set, or set to any other value than "Development"?
Context
I've created a new ASP.NET Core Web Application using the VS 2022 built in template (.NET 6, but I do not think the issue/question is .NET 5 specific) I did not altered the created application in any way
I am able to run my ASP.NET Core web application under IIS Express, or without IIS Express using Visual Studio, based on launchsettings.json., I mean using the green triangle dropdown, and pick WebApplication instead IIS Express
Just for the sake of curiosity, I've tried to launch the WebApplication1.exe from the bin folder. It starts, I can access it via browser using https://localhost:5001/, the page loads, but without CSS, JS. I can see that all requests for static resources have a 404 response.
I suspect that I should somehow configure the app, where the static web resources are. I see that the corresponding WebApplication1.runtimeconfig.json and WebApplication1.staticwebassets.runtime.json (formerly WebApplication1.staticwebassets.xml) are there... but later I figured out that magically the environment ASPNETCORE_ENVIRONMENT is related to the issue.
What I've tried so far?
In the command shell I set the environment variable to
SET ASPNETCORE_ENVIRONMENT=Development
...then started then I started WebApplication.exe, this case all is working, static web assets are served.
Question
In the very simple Program.cs and startup code I do not see any conditional logic regarding ASPNETCORE_ENVIRONMENT variable, so I do not understand the issue, why is the difference? (I've also checked the differences between the two appsettings.json and appsettings.Development.json: no related differences.
As an ultimate goal, I would like to automate the start of the WebApplication.exe for functional testing purposes, and I would like to start it sometimes as ASPNETCORE_ENVIRONMENT=Development but other times without that setting.
Why is the difference regarding static web assets serving depending on ASPNETCORE_ENVIRONMENT=Development, and how to run and serve static web assets without that setting from command line?
The question is a bit misleading, as the artifacts in bin/Debug folder is for debugging and not for general testing, so it is not guaranteed to work or supposed to work as you described.
The reason why you found it is not working is because there is no static assets in bin/Debug folder. It works in development environment and not in production (the default when no environment set) because the default builder calls UseStaticWebAssets only in development environment.
https://github.com/dotnet/aspnetcore/blob/4e7d976438b0fc17f435804e801d5d68d193ec33/src/DefaultBuilder/src/WebHost.cs#L221
Inside UseStaticWebAssets, it processes .staticwebssets.runtime.json file to resolve the real path of your static assets. That is how it works and why it does only when environment is development.
If you want to have it works as it supposes to, you should publish your project to a folder and call the executable from there. The publish tool will also publish your static assets into that folder so it will work whether you set the environment config or not.

Does Apache Cordova need a server?

I see that it uses HTML, CSS, and JS, but does that package with the app or does it need a server if it is a static page?
Also if a server is needed could i get away with hosting on Github pages.
Your HTML, CSS, and JS files are bundled with the app bundle and loaded from local storage. This means that your content comes from file:// (unless you have certain plugins installed that create an http server on localhost).
You'll only need a server if you need one as a backend (which you'd communicate with via XHR/Ajax).

red5 web app provide external static resource

I am new to Red5. From my Red5 webapp I need to provide static content (in external directory) as a resource. In red5-web.xml,
<mvc:resources mapping="/videos/**" location="file:/user/recordings/" />
I spent lot of time but could not figure out why its not working (getting 404).
Any suggestions will be very helpful. Thank you.
Since Red5 uses embedded Tomcat for its Java EE container, you should be able to externally link resources via their configuration. In addition, there should be no restrictions that I know of when using Spring MVC (if that's what you're using).
Here are some links for you to review:
Tomcat Context
Serving external images
Source paths and Aliases

How to get Apache Tomcat running with jsp files?

I'm new to web servers and would appreciate your help. I was given JSP files (and some other css and javascript files) and I'm trying to figure out a way to quickly get these JSP files up and running on the Apache Tomcat server just to view them. I got the Tomcat server running using Eclipse, but now I'm not sure how I can run the JSP files. Do I need a web.xml file? I've looked at some examples of web.xml but I am not sure what pieces are needed.
If there is anything that you can give me to lead me in the right direction, it would be extremely helpful. Thanks in advance!
Have a look here: http://www.vogella.com/articles/EclipseWTP/article.html
In short:
Install the WTP extension and create a new Dynamic Web Project. Set the project to run with the Tomcat managed by Eclipse.
Then copy your JSPs to the project and start Tomcat through Eclipse.
Maybe you can convert your existing project to a Dynamic Web Project.

Strut Framework

Recently i have completed my first project using strut framework. And i want to run the project in my web space (www.mywebsite.com) instead of running it as http://localhost . How do i run it in my website? Can someone guide me please.
Thanks
First, you need an application server, if your application only uses Servlet API (you don't have EJB's) I recommend you that install tomcat or jetty servers.
Second, you must package your application in a WAR file; depending on the build tool you are using, it probably offers you some facilites to do that
Third, deploy the WAR file in the application server