hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd W Lainhart <lainh...@us.ibm.com>
Subject HttpContext and RequestConfig
Date Tue, 14 Oct 2014 15:37:56 GMT
HttpClient 4.3.5 / HttpCore 4.3.2

I've got an execution context, that while appears to be a single 
call/response to the caller, can result in multiple network calls - 
multiple CloseableHttpClient.execute(...) invocations.  Those invocations 
share HttpContext state, mainly for a shared cookie store.  The 
CloseableHttpClient has a  custom RequestConfig associated to it.

One of the invocations creates a new HttpRequest object, with its own 
RequestConfig that overrides the default.  On subsequent invocations I was 
surprised to see that the RequestConfig that I set on the request became 
the shared HttpContext's RequestConfig state, which is used in subsequent 
invocations.  Reading the source confirms this - the request's config is 
set on the "local context", which is the shared context I mentioned 
earlier.

Is this the intended behavior?  I can see it both ways.

I can work around this by clearing the request config on the context on 
that one call, but I wanted to raise the question in case I'm missing a 
concept.  I'm also not finding a "clone" or "copy" of a context, which I 
thought I had seen at one point.





Todd Lainhart
Rational software
IBM Corporation
550 King Street, Littleton, MA 01460-1250
1-978-899-4705
2-276-4705 (T/L)
lainhart@us.ibm.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message