java - How do I get chunked footers from a response on a connection that uses ThreadSafeClientConnManager? -
java - How do I get chunked footers from a response on a connection that uses ThreadSafeClientConnManager? -
i'm using connection created threadsafeclientconnmanager (apache httpcomponents 4.1.1). response chunked (which expect), determined response.getentity().ischunked()
however, there no way footers/trailers (which necessary our application). since response chunked, expect entity contents of type chunkedinputstream, default request director , executor classes used client wrap original response entity (which, looking @ httpcomponents source have been chunkedinputstream) in basicmanagedentity.
in short, no longer able footers/trailers off of response, basicmanagedentity not create underlying entity available use. know how work around this?
for reference, see:
org.apache.http.impl.client.defaultrequestdirector.java, lines 523-525 org.apache.http.impl.entity.entitydeserializer.java, lines 93-96
one can utilize http response interceptor in order access chunked content stream , response footers.
httpclient.addresponseinterceptor(new httpresponseinterceptor() { public void process( final httpresponse response, final httpcontext context) throws httpexception, ioexception { httpentity entity = response.getentity(); if (entity != null) { inputstream instream = entity.getcontent(); if (instream instanceof chunkedinputstream) { header[] footers = ((chunkedinputstream) instream).getfooters(); } } }
});
java footer chunked-encoding apache-httpcomponents
Comments
Post a Comment