how to access data from another web application - java

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

Related

Angular 2 application deployed on JBOSS 6.4 eap with java services as backend

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"
}

How to access application in Tomcat with Context path

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

How to acces files without servlet in tomcat

I want to access file (for example from http://localhost:8080/myweb/styles.css), but i dont want to write servlet for each static file on my web. Is there any way how to access that file without servlet? I am using tomcat 7.
You do not have to write servlet for this. All files located in root of your web application are accessible via HTTP.
For example if your web application has only one file styles.css, i.e. you have folder myweb that contains this file under $TOMCAT_HOME/webapps it is accessible automatically.

Few questions over the redirection stuff?

UTIL.getServletPath("/SetupPage?PG=setupusersettings") %>">
What is SetupPage. Is it an directory?
Why ? is used?
What is PG?
setupusersettings is an jsp page, all i can find and it will redirect to that page.
you need to learn the basics of web programming. You can find millions of stuffs on Web about it. Shortly;
/SetupPage?PG=setupusersettings
SetupPage seems like a web application, you requested. Basicly, as soon as you call /SetupPage, the request will be sent to this application.
"?" is a seperator. after that, you can send parameters (you can send parameters using HTTP GET/POST) to this application. In this case, the name of parameter is PG and the value "setupusersettings". For exampe, you can access the value of this parameter in your web application
Google "Web programming java servlet tutorial"
Regards.
If you click on the resulting link (URL) it will (literally) "call the resource /SetupPage with the attribute/value pair [PG -> setupusersettings]".
PG is an attribute name (could be an acronym for Page).
Look for a resource named "SetupPage.???" (could be a python/perl script or any other executable file). You may have to look at the http servers configuration files to get the local location of this file. The redirection to is most probably done by this executable.

ASP.NET/IIS equivalent of Java/WAS context-root

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"

Categories