hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpContext and RequestConfig
Date Wed, 15 Oct 2014 18:44:06 GMT
On Wed, 2014-10-15 at 10:50 -0400, Todd W Lainhart wrote:
> Thanks Oleg -
> 
> Unless I'm missing something, I was thinking that it had to be something 
> along these lines:
> 
>             /*
>              * Disable redirection for this one POST request
>              */
>             RequestConfig oldConfig = context.getRequestConfig();
>             RequestConfig newConfig = RequestConfig.custom
> ().setRedirectsEnabled(false).build();
>             context.setRequestConfig(newConfig);
>  
>             try {
>                 response = httpClient.execute(targetHost, postMethod, 
> context);
>             } finally {
>                 context.setRequestConfig(oldConfig);
>             }
>  

That certainly works, too. 

Oleg


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


Mime
View raw message