Aha - I knew there was a way... :)
So the correct way of doing what I described is to use the
HttpRequestInterceptor and in it I'd use the HttpContext objects
getAttribute(ExecutionContext.HTTP_TARGET_HOST) followed by the HttpRequest
object getRequestLine().getUri(), I guess.
My code now look like this (if anyone wants to do the same):
client.addRequestInterceptor(new
HttpRequestInterceptor() {
public void process(HttpRequest request,
HttpContext context)
throws HttpException,
IOException {
newuri =
((HttpHost)context.getAttribute(ExecutionContext.HTTP_TARGET_HOST)).toURI()
+ request.getRequestLine().getUri();
}
});
Thanks a bunch!
Magnus
Roland Weber wrote:
>
> Hello Magnus,
>
> the target host of the request is available after execution from
> the HttpContext. The attribute is ExecutionContext.HTTP_TARGET_HOST:
>
> http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/protocol/ExecutionContext.html#HTTP_TARGET_HOST
>
> The value is an instance of HttpHost.
>
> cheers,
> Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Redirected---but-where--HttpClient-4-tp14648060p14648906.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]