hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "THIL Laurent (CAP-GEMINI)" <laurent.thil.cap-gem...@groupe-mma.fr>
Subject Issue with Http OPTIONS request and htt-client-cache
Date Mon, 16 Nov 2015 15:16:30 GMT
We have http requests of type OPTIONS that hit the CachingHttpClient that return in exception.
I put a stack trace below:

       at org.apache.http.impl.client.cache.RequestProtocolCompliance.addContentTypeHeaderIfMissing(RequestProtocolCompliance.java:187)
       at org.apache.http.impl.client.cache.RequestProtocolCompliance.verifyOPTIONSRequestWithBodyHasContentType(RequestProtocolCompliance.java:183)
       at org.apache.http.impl.client.cache.RequestProtocolCompliance.makeRequestCompliant(RequestProtocolCompliance.java:106)
       at org.apache.http.impl.client.cache.CachingHttpClient.execute(CachingHttpClient.java:423)
       at org.esigate.cache.CacheAdapter$HttpClientWrapper.execute(CacheAdapter.java:128)
       at org.esigate.http.HttpClientHelper.execute(HttpClientHelper.java:238)
       at org.esigate.Driver.executeSingleRequest(Driver.java:440)
       at org.esigate.Driver.execute(Driver.java:444)
       at org.esigate.Driver.proxy(Driver.java:225)
       at org.esigate.servlet.AggregatorServlet.service(AggregatorServlet.java:85)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

The problem seem to lie in method addContentTypeHeaderIfMissing:

private void addContentTypeHeaderIfMissing(final HttpEntityEnclosingRequest request) {
        if (request.getEntity().getContentType() == null) {
            ((AbstractHttpEntity) request.getEntity()).setContentType(

The line  'if (request.getEntity(). ' will return null, because there is no entity in a OPTIONS
request, from there the null pointer exception.
In the case of a GET request to the CachingHttpClient, the field entity is null as well, but
were not running in 'verifyOPTIONSRequestWithBodyHasContentType ...

Is this behavior expected - we are missing something,  or truly a bug.

We are currently running httpclient 4.2.5,  but I see the same code in the trunk of the project.


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