commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodney Waldhoff <>
Subject Re: [HttpClient] Redirect to a different Host
Date Fri, 13 Dec 2002 17:02:09 GMT
For technical/design reasons it is awkward for httpclient's HttpMethod
class to change the HttpConnection parameters in this way.  The Method
is essentially given a socket connection to a given host that it
cannot simply point at a different server (see HttpMethodBase.execute).
This will probably be addressed eventually, but I'm not sure how it
relates to the 2.0 final release plan (which is moving toward a 2.0 alpha
2 release rather soon).

In the interim, in the case of a cross-server redirect, HttpClient will
return the redirect status code (302).  Your client code can detect this
response, obtain the response "Location" header (where we're being
redirected to) and "resubmit" via a new call to HttpClient.executeMethod
or HttpMethod.execute, passing in a new HttpConnection or
HostConfiguration pointing to the appropriate host.

On Fri, 13 Dec 2002, Wong Ka Ho Matthew wrote:

> Hello,
>     i found that the GetMethod of the HttpClient won't follow the
>     redirects if the location of the resource is resides on another host.
>     is there any suggestion on how to use the GetMethod of the
>     HttpClient to deal with a redirect to resource that is on a different
>     host?
> ---
> matt
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

View raw message