You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Schreier, Balz" <Ba...@sunrise.net> on 2003/01/21 14:30:47 UTC
[HttpClient] - redirect not supported
hi,
i downloaded the latest release (not alpha, but the release from january
03).
everything works fine except in case where the URL i am accessing wants to
redirect to another location.
In the logfile i see a warning like
WARN httpclient.HttpMethod - Redirect from host www.foobar.ch to
www.foobar2.ch is not supported
Is there a way to catch this redirect?
Excerpt of my code:
The following classes are used:
import org.apache.commons.httpclient.HttpConnection;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.methods.GetMethod;
In the code, the calling lines are:
HttpConnection httpC = new HttpConnection(url.getHost(), port);
httpC.setSoTimeout(getHttpTimeout());
httpC.open();
HttpState state = new HttpState();
GetMethod method = new GetMethod(url.toString());
method.execute(state, httpC);
InputStream in = httpC.getResponseInputStream(method);
THANKS!!!!!!!!!!!!!!!
Balz Schreier
Re: [HttpClient] - redirect not supported
Posted by Ortwin Glück <or...@nose.ch>.
The problem is that each request is made on a per host basis. Redirects
to different hosts than the original one are currently not supported.
You have to issue a new request to the new host in this situation.
Odi
Schreier, Balz wrote:
> hi,
>
> i downloaded the latest release (not alpha, but the release from january
> 03).
> everything works fine except in case where the URL i am accessing wants to
> redirect to another location.
> In the logfile i see a warning like
>
> WARN httpclient.HttpMethod - Redirect from host www.foobar.ch to
> www.foobar2.ch is not supported
>
> Is there a way to catch this redirect?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>