On Wed, Dec 19, 2018, 09:41 Khare, Aparna <[email protected] 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..
>
> rsClient = new DefaultHttpClient();
> rsClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
> TESTCONSOLE);
> rsClient.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS,
> false);
>
> Thanks,
> Aparna
>
>