Saiprasad Natarajan

Greenhorn
+ Follow
since Oct 27, 2010
Saiprasad likes ...
Eclipse IDE Oracle Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Saiprasad Natarajan

Hi

I seem to have messed up the understanding of java.net.URLConnection.

Objective: I have 2 Webapps running on different servers. I want to transfer control from WebApp1 on Server1 to WebApp2 on Server2.
A simple response.sendRedirect(dest) would ideally suffice but since i have a pretty large amount of data to be passed on from WebApp1 to WebApp2, i do not want to send all the data in the URL hence i thought of using the HttpURLConnection.

Here is my sample Code:
From my Servlet1 in WebApp1, i do the following.



Will the above code do a redirect to WebApp2 along with the data in OutputStream?
If someone could explain what exactly URLConnection does, it would be great and if my usage of this Class in this particular context is right or not?

Thanks in Advance
Sai
13 years ago

another is to transmit the data directly between the two servers; you can use HTTP for that as well.



Hi

Can you please tell me how this can be done using Http?

Thanks
13 years ago
Ok. Here's the problem in Detail.

I have a WebApp1 in Server1. This WebApp1 takes inputs from the user and using JavaScript i send these Details to another App, WebApp2 in Server2.
This is how i do it in WebApp1


WebApp2 is a servlet where i use input1 and input2 for processing and after which i need to redirect this to another WebApp say WebApp3 in Server3.

I do this using:


So basically when my inputs are flowing from Server1 to Server2 to Server3, they are seen in the URL which is what i feel makes it vulnerable hence the need to secure this entire process.

The reason i say its redirection is the Control basically moves from Server1 to Server3 with Server2 deciding the final destination, which in this case is Server3.

Hope this helps

Thanks
13 years ago
Hi Ulf,

how else would i send data from one server to another?
I am using a response.sendRedirect(URL) for the redirection and this URL is not on the same server.
When this happens, it is going to be a new request altogether so i guess POST is not possible. If it is, can you please tell me how?

TIA



13 years ago
Hi

I have 2 apps hosted on different servers.
I need certain inputs from App 1 to process in App 2, I figured out the only possible way is to send these parameters is using the GET method.
Due to this all the parameters required in App 2 will be visible in the URL while redirection.

Is there anyway i can secure this server-server communication, so that any user cannot just copy the URL visible during redirection and misuse it.

I have tried out encryption of the parameters being sent but that also is not too secure.

Would appreciate if someone could point out a way to do this.

TIA


13 years ago
Hi

Does InitialContext() initialize a context to the server where the calling application is deployed?

And if i need the JNDI look up to happen at the current server itself, would new InitialContext() suffice or do i need to specify the environment also?

TIA
13 years ago
Thanks for the reply.

I am passing the data using query parameters but i was just wondering if there is a way to differentiate between a redirect and when someone accesses the app from the address bar directly.


Thanks
13 years ago
Hi

If i add a custom header to the HttpServletResponse object, like say,



and then do a response.SendRedirect(URL) to some other URL, will i be able to read this header value at that app?

I've tried this with 2 dummy servlets in different apps but doesn't seem to be working. Am i getting something wrong here or am i trying something which is not right?

At the redirected URL, i retrieve the headers using request.getHeader(headerName);

TIA
13 years ago

Could you let us , why are you attempting for such a thing ?? so taht we can help you achive your requirement . Thnaks



There is an application on Server1 and another application on Server2. The application starts off from Server1 and in the interim, i need to process some info in Server2 and then back. To process this info, i need the request object from Server1's application.
These 2 apps being on different servers, how do i maintain a session between them?

Passing the required data to server2 through query parameters is not an option since there are too many of them.

I am in the process of trying the HttpProxyServlet (weblogic) but i am not sure if RequestDispatcher can forward requests to app in other servers.

I read something about Coherence in this forum, not sure if that worked for someone?

Thanks
Sai
13 years ago
Hi

Is there anyway i can get the servletcontext of a web app in a server not the same as the one in which the current app is hosted?

For Ex,

WEBAPP A is in WEBSERVER B, and WEBAPP C is in WEBSERVER D.

I need to get the context of WEBAPP C in WEBAPP A.

getServlet().getServletContext().getContext("WEBAPP C") would have got it if WEBAPP C was in server B.

Is there anyway i can set the server to look in first and then get the context after that?

TIA
Sai
13 years ago
Hi

I have an XML which is something like this:



All i want to do is get the queryValue by passing the queryName.
For ex: if I pass "CreateTask" to some function, the return value shoud be "Creating".

I am not sure if the DocumentBuilderFactory and other classes retrieve the value based on name.

Any pointers please?

TIA
13 years ago
Hi

I am currently using the Eclipse Ganymede. I know the inbuilt Ant package is Ant 1.7.
My query, is it possible to make eclipse use the version of ant which is set in the environment variable ANT_HOME ( this not being 1.7)?