[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13534069#comment-13534069
 ] 

Francois-Xavier Bonnet commented on HTTPCLIENT-1240:
----------------------------------------------------

Ok, I had a look at the code. Just to be sure I understand well: HttpParams got 
deprecated, it has been replaced by RequestConfig which is an object that you 
create with a builder and then you cannot modify it. So there is no replacement 
for what we could do before like adding params during request processing (for 
example in HttpRequestInterceptor) and retrieve them later in another 
HttpRequestInterceptor or in a HttpResponseInterceptor ?
                
> Empty HttpParams for cacheable requests
> ---------------------------------------
>
>                 Key: HTTPCLIENT-1240
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1240
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.2.1
>            Reporter: Francois-Xavier Bonnet
>            Priority: Minor
>
> With DefaultHttpClient, HttpResponse.getParams() returns a ClientParamsStack 
> with all the parameters previously set at HttpClient or HttpRequest level.
> With CachingHttpClient it returns an empty BasicHttpParams when a response is 
> cached.
> This feature can be very usefull when you are doing complex processing with 
> Interceptors for example. It is described in HttpClient documentation:
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d5e299
> http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/ClientParamsStack.html
> CachingHttpClient should not break this feature.
> Here is some sample code:
>       // Client and Request scoped params with DefaultHttpClient
>       DefaultHttpClient httpClient = new DefaultHttpClient();
>       httpClient.getParams().setParameter("testClientParam", 
> "testClientParam");
>       HttpGet httpGet = new 
> HttpGet("http://www.google.fr/images/srpr/logo3w.png";);
>       httpGet.getParams().setParameter("testRequestParam", 
> "testRequestParam");
>       HttpResponse response = httpClient.execute(httpGet);
>       EntityUtils.consumeQuietly(response.getEntity());
>       
> System.out.println(response.getParams().getParameter("testClientParam"));
>       
> System.out.println(response.getParams().getParameter("testRequestParam"));
>       // Same test with CachingHttpClient
>       httpClient = new DefaultHttpClient();
>       CachingHttpClient cachingHttpClient = new CachingHttpClient(httpClient);
>       cachingHttpClient.getParams().setParameter("testClientParam", 
> "testClientParam");
>       httpGet = new HttpGet("http://www.google.fr/images/srpr/logo3w.png";);
>       httpGet.getParams().setParameter("testRequestParam", 
> "testRequestParam");
>       response = cachingHttpClient.execute(httpGet);
>       EntityUtils.consumeQuietly(response.getEntity());
>       
> System.out.println(response.getParams().getParameter("testClientParam"));
>       
> System.out.println(response.getParams().getParameter("testRequestParam"));
> If you agree I can provide a patch and unit tests

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to