hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MaGGE <mag...@magge.no>
Subject Redirected - but where? HttpClient 4
Date Sun, 06 Jan 2008 12:50:15 GMT

Hello,

I've just started using HttpClient for a little util I'm making. I'm letting
it handle_redirects=true, but I need to process the URL it's been redirected
to. How can I find the "current URL" after I've executed a request that was
redirected?

I've tried a couple of things - which I feel is "wrong". First thing was to
disable handle_redirects, and look for the "Location" header in a loop of my
own. Challenge with this was that I could not see any way to replace the URI
for the request object, so I'd have to make a new one - which is a problem
because my method should be able to process any HttpUriRequest.

Second I tried to add a HttpRequestInterceptor to the client. But all I can
get from the HttpRequest object given to the process method is the
RequestLine. That one only has the info found behind GET/POST etc, that is
only the path and method. I'm still lacking the host, protocol and so on.

I'm sure there's an easy way to do this that I've just missed ... Please
advice. :)

Thanks for your time,
Magnus
-- 
View this message in context: http://www.nabble.com/Redirected---but-where--HttpClient-4-tp14648060p14648060.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message