[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joshua Spiewak reopened HTTPCLIENT-1202:
----------------------------------------


Okay, grabbed the source, built and installed. For my response that is a 204 I 
get the following exception:

{code}
java.lang.IllegalArgumentException: Resource may not be null
        at 
org.apache.http.client.cache.HttpCacheEntry.<init>(HttpCacheEntry.java:101)
        at 
org.apache.http.client.cache.HttpCacheEntry.<init>(HttpCacheEntry.java:131)
        at 
org.apache.http.impl.client.cache.BasicHttpCache.cacheAndReturnResponse(BasicHttpCache.java:252)
        at 
org.apache.http.impl.client.cache.CachingHttpClient.handleBackendResponse(CachingHttpClient.java:909)
        at 
org.apache.http.impl.client.cache.CachingHttpClient.callBackend(CachingHttpClient.java:722)
        at 
org.apache.http.impl.client.cache.CachingHttpClient.handleCacheMiss(CachingHttpClient.java:502)
        at 
org.apache.http.impl.client.cache.CachingHttpClient.execute(CachingHttpClient.java:434)
        at 
org.apache.http.impl.client.cache.CachingHttpClient.execute(CachingHttpClient.java:353)
        at 
org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:88)
        at 
org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:46)
        at 
org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:49)
        at 
org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:438)
        at 
org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
        at 
org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:199)
{code}
                
> ResponseCachingPolicy should honor explicit cache-control directives for 
> non-recognized status codes
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1202
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1202
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.3, 4.2 Final
>            Reporter: Joshua Spiewak
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.2.1
>
>
> From my reading of [rfc2616 section 
> 13.4|http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4], I see a 
> list of response codes that MAY be stored. These correspond to the codes that 
> ResponseCachingPolicy checks. However, the last paragraph of the section 
> states that other status codes MUST NOT be returned *unless* there are 
> cache-control directives. In my case, I am setting Cache-Control: 
> max-age=xxxx and as such I would expect the response to be cached.
> The return statement of ResponseCachingPolicy.isResponseCacheable looks like 
> it was meant to take into account explicit cache control directives, but I 
> think that return is only ever reached when cacheable is set to true, and is 
> essentially not used.
> Would it be possible to enhance ResponseCachingPolicy to handle this? If not, 
> would it be possible to make the choice of response caching policy 
> configurable/extensible/pluggable?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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