I have a servlet (call it Servlet A) that once called opens an Http Connection on another server with another servlet (call it Servlet B). This is done using java.net.HttpURLConnection.
The URL for Servlet B actually points to a load balancer, so my request gets redirected to the appropriate host.
My question is as follows: is there a way for Servlet A to get the host or ip to which it gets redirected?
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
1
posted
0
Looking at the JavaDocs it appears that setFollowRedirects is true by default. Perhaps you could set that to false and handle the new address in your code.
Originally posted by William Brogden: Looking at the JavaDocs it appears that setFollowRedirects is true by default. Perhaps you could set that to false and handle the new address in your code.
Bill
Thanks! I saw that but it never registered.
I found a code sample in the apache commons project:
[ June 10, 2008: Message edited by: Marwan Oweis ]