views:

140

answers:

1

I'm using Apache HttpClient 3.x for contacting a Big IP that will then redirect my request to one of 1-N machines. We have the need to know which of the N machines actually picked up the request though, and I'm not sure how to get this information. I looked through the Response headers with no luck, so I'm wondering if this information is actually provided anywhere? Is there a helper/utility class I can use to get any additional metadata?

Thanks.

+1  A: 

If the request is redirected and you need the new location, you need to setFollowRedirects(false) on the method and handle the redirect yourself.

After sending the request, check getStatusCode() for 302 and getResponseHeader("Location") for the new address. Than change the address by setURI() and send again.

Arne Burmeister
Wow, that would probably work. Not sure if I want to inherit that redirecting responsibility but unless someone else can come up with something better, I'll mark this as an answer in a day or two.
Greg Noe