Blackberry reading mod_deflate compressed page

162 Views Asked by At

I am using Apache mod_deflate to return compressed html from a webpage. It has reduced the generated page size from 3k down to 700 bytes.

How do I use HttpConnection in Blackberry to get the compressed page (i.e. only 700bytes instead of 3k)?

P.S. Trying to use the GZIPInputStream(inputStream) keeps returning an incorrect header check error.

1

There are 1 best solutions below

4
On BEST ANSWER

As I understood you already tried to download and got non-compressed html page.

If so I think you should add "Accept-Encoding" header to your request (question on forum). Try:

connection.setRequestProperty("Accept-Encoding", "gzip, deflate");

Don't forget that you will get zipped data, so you need to unzip before using.

Also, as mentioned here, gzip/deflate is not so efficient when your traffic is going over BIS-B, BES. Because BB servers will encode/decode data to analyze it and make it more efficient fro transmission.