Forums Register Login

Help with (Http)URLConnection!

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1176 times.
Similar Threads
HTTPS Post Request through the URL
Passing parameters to url using java.net package
post request to url
Simple Question - AJAX and JAVA, Is It Possible?
Java Website post
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:01:49.