This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with (Http)URLConnection!

 
Saiprasad Natarajan
Greenhorn
Posts: 12
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tejas Shah
Greenhorn
Posts: 23
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No redirection will occur ..this will send a request to webapp2.
You will be able to get response in the connection's input stream. Basically it makes your application a proxy between the target and client.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic