hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@redwerk.com
Subject Re: invalid redirect
Date Wed, 05 Jul 2006 17:49:03 GMT
On Wed, Jul 05, 2006 at 07:42:53PM +0200, Roland Weber wrote:
> Hello Eugeny,
> > Could you please explain how can I handle redirects? Is there any way for
> > placing hook or register some callback?
> Disable automatic redirects so your application will get the 30x response.
> The redirect target is given in the Location: response header. Convert it
> to a valid, absolute URL and have your application send another request
> for the new URL.

Okay, so in general after executeMethod I need to test it for header
"location", if this header exists - I need to create another URI, create new
Get method and execute it unless redirect limit exceeds or location header is
missing.

Could you please explain, how would I deal with relative URIs, may be there is
simple way to validate if the URI is relative and how to handle it?

for instance, if i query page
http://somesite.com/somedir/someanotherdir/page.html and it returns
/index.html, the resulting URL must be http://somesite.com/index.html - not
http://somesite.com/somedir/someanotherdir/index.html

I know it is done internally in HttpClient somehow (when automatic redirects
are enabled), but I looked at sources and got confused.

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


Mime
View raw message