On Thu, 2010-08-12 at 07:51 -0700, hbfkf wrote:
> Hi everybody,
>
> I am trying to get the URL from within a HttpRequestRetryHandler in
> HttpClient 4. Is there a supported way to achieve this?
>
I assume by URL you mean the request URI
---
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.setHttpRequestRetryHandler(new
DefaultHttpRequestRetryHandler() {
@Override
public boolean retryRequest(
IOException exception, int executionCount, HttpContext
context) {
HttpRequest request = (HttpRequest)
context.getAttribute(ExecutionContext.HTTP_REQUEST);
System.out.println(request.getRequestLine().getUri());
HttpHost target = (HttpHost)
context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
System.out.println(target);
return super.retryRequest(exception, executionCount, context);
}
});
---
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]