On Wed, 2018-12-19 at 07:41 +0000, Khare, Aparna wrote:
> Dear All,
>
> We have some constraints in moving to new httpclient and we are using
> 4.1.3. Any help is appreciated. gzipContent works but deflated is not
> working.
>
> if (response.getEntity() != null) {
> HttpEntity entity = response.getEntity();
> Header contentEncodingHeader = entity.getContentEncoding();
>
> if (contentEncodingHeader != null) {
> HeaderElement[] encodings
> =contentEncodingHeader.getElements();
> for (int i = 0; i < encodings.length; i++) {
> if
> (encodings[i].getName().equalsIgnoreCase("gzip")) {
> entity = new GzipDecompressingEntity(entity);
> break;
> } else
> if(encodings[i].getName().equalsIgnoreCase("deflate")) {
> entity = new
> DeflateDecompressingEntity(entity);
> break;
> }
> }
> }
>
> And we use the below mechanism to set the params in the httpclient ..
> I have read that I need to disable the compressions. But I could not
> find how can I set that..
>
HttpClient 4.1 does not support automatic content decompression. You do
not need to disable it.
Oleg
> rsClient = new DefaultHttpClient();
> rsClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
> TESTCONSOLE);
> rsClient.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS,
> false);
>
> Thanks,
> Aparna
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]