I have a web application which is developed with J2EE, GWT and hosting on Tomcat(version-7.0). I have webapp called "Courses"
which is plcaed in tomcat/webapps folder. I am accessing my "courses" application by using the following Url:
http://localhost:8085/Courses.
In my courses application i have so many slices like "physics", "maths" etc.I need to access "physics"
Now i want to access my application by entering the Url:
http://localhost:8085/Courses/physics
How can I run my courses application by entering the above URL.
In GWT you should use GWT's history mechanism for this.
The URL you wish http://localhost:8085/Courses/physics isn't really possible using GWT (or you must create multiple modules but that seems a big overkill for your situation).
But you could have an url like : http://localhost:8085/Courses#physics
Check : http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsHistory.html
Related
Problem 1: Angular 2 application deployed on JBOSS server but not able to load static content (js/css). The problem is the website is hosted under its own context (localhost:8080/sample/) and static resources is refered in index.html as (link href="css/index.css" rel="stylesheet") however it doesnt get loaded as network calls are made to localhost:8080/css/index.css.
I need it to point to localhost:8080/sample/css/index.css
Problem 2: Alternately we tried hosting angular application on tomcat but services need to be hosted on jboss, we tried implementing CROS filter (https://amodernstory.com/2014/12/27/using-cors-headers-with-java-example/) but the first request goes through but other request shows pending status in Chrome network's tab.
I'm having the same problem. To get it to load the static content, you need to set the base href inside index.html to "./". I have found that "." also works. The application should then load properly, BUT you will run into another problem: if you try to visit any of the application routes directly using the address bar, you will see "Not Found". This seems to be related to JBoss's ability to rewrite HTML5 URLs and redirect them to the index. I am trying to solve that problem using the information on this page: https://issues.jboss.org/browse/JDF-512. I will let you know if I succeed.
You can create an index.prod.html with the correct references to "/sample/css/index.css". Then add the following in the angular.json
"production": {
"fileReplacements": [
{
"replace": "src/index.html",
"with": "src/index.prod.html"
}
I have some personal project where I am trying to share some class instance between webapp and a normal app. My project structure is something like below:
+ NormalApp
+ WebApp
I am starting the application from the NormalApp and I included WebApp using EmbeddedTomcat. Now I have a class named Notifier in WebApp. I want to use the instance of Notifier in NormalApp without losing it's state.
Could someone tell me how can I achieve this scenario?
I have some plan in mind like setting the Tomcat class loader to use Systems class loader. I tried it but couldn't able to achieve it. Is my understanding of this wrong?
Have you tried making your normal app like web components ? so your application will be available when tomcat start. And you can use System properties to pass parameters to the tomcat.
Another option is using Spring boot. Here is a tutorial
https://spring.io/guides/gs/spring-boot/
http://spring.io/guides/tutorials/bookmarks/
I have two application name "appserver" and "ftpserver" both on same tomcat server. like this:
appserver: "http://myapplication.org/appserver"
ftpserver: "http://myapplication.org/ftpserver"
appserver is the main application of my project and I want to "upload" & "get" some files to/from ftpserver. so how do i can get the url/path of the ftpserver in Java, JSP, & java script??
If you are using spring, you can go with RestTemplete for this case.
enter link description here
I have an application with name test.war.
Because of Apache installed on my server I have to use another port number for Tomcat applications so after deployment this application available at domain.com:8080/test/.
I decided to create a subdomain in order to remove that ugly 8080 from url, so I setted up the server like described here. So now test.domain.com reffers to domain.com:8080/test/.
Everything seems fine except of one problem - because my application is not ROOT.war and I am using spring:url function every url in the application is translated to /test/bla-bla. So I removed that function. But still have a problem with spring security because it still translates an urls relative to app name i.e. /test/bla-bla.
How can I solve that problem?
Thank you
UPD: I don't want to deploy it as a ROOT application because I have two or three such applications and I wanted to create a subdomain for each one of them
Spring Security doesn't "translate" URLs. In fact this isn't specific to Spring Security. You'll run into similar issues with any application which does redirects. If you want to hide the context paths of applications which are behind a proxy, then you need to rewrite the URLs at the proxy.
I'd recommend you read the Tomcat Generic Proxy Howto and the section on URL rewriting in particular, as it specifically addresses this issue.
In Java on WebSphere Application Server if I want my servlets, etc., to start with a certain root path, I use the context-root property in the EAR deployment descriptor (application.xml). For example, my servlet is named GetData, but I want the URL to be www.mysite.com/secure/restricted/GetData, so I set the context-root to secure/restricted.
How do I do that in ASP.NET on IIS? Is the some kind of configuration setting for the application?
One option would be Url Rewritting - http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
On the other hand, if you have your dynamic asp.net site separated from the rest of your content, you can add the folder secure/ and configure in there through the IIS Manager to point restricted to your asp.net site (regardless of where you have it stored).
That said, I don't know whether the WAS context-root give you something extra, for links to other info outside the asp.net site.
In .Net Core 2.0, there is an applicationUrl property in launchSettings.json:
By default, it will be "http://localhost:port/GetData" or "http://localhost:port"
Just change it to your final URL:
"http://localhost:port/secure/restricted/GetData"