Thank Oleg but if that is the case do I still need to send type cast to 
GzipDecompressingEntity..without casting to GzipDecompressingEntity Im not 
getting byte[] some encoding issue with the response content



I have seen that when I get the response content as InputStream and convert it 
to



try {

        ByteArrayOutputStream outStream = new ByteArrayOutputStream();

        int value = inStream.read();

        while (value != -1) {

          outStream.write(value);

          value = inStream.read();

        }

        response = outStream.toByteArray();



}



It is not sending the byte[] properly..



-----Original Message-----
From: Oleg Kalnichevski <ol...@apache.org>
Sent: Wednesday, December 19, 2018 3:47 PM
To: HttpClient User Discussion <httpclient-users@hc.apache.org>
Subject: Re: Issue with deflate Content-Encode httpClient 4.1.3



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: 
httpclient-users-unsubscr...@hc.apache.org<mailto:httpclient-users-unsubscr...@hc.apache.org>

For additional commands, e-mail: 
httpclient-users-h...@hc.apache.org<mailto:httpclient-users-h...@hc.apache.org>


Reply via email to