Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Developer927
Posts: 6
Registered: ‎06-30-2011
My Device: Torch

Does the BrowserField2 support GZIP?

[ Edited ]

Hi. I'm wondering if the BrowserField2 (JRE 5/6) supports gzip compression. I have successfully set my headers to pass Accept-Encoding:gzip, and the server logs confirm this, but when the page is displayed in my app, it's just gibberish (crazy characters and whatnot). When I remove that header, the page displays fine, but it not compressed.

 

FYI - The same page loads just fine in the built-in Blackberry Browser.

 

Any ideas are much appreciated!! Thanks!

Developer
ankityadav4u
Posts: 231
Registered: ‎03-16-2011
My Device: 9700, 9550, and JDE

Re: Does the BrowserField2 support GZIP?

try like this......

headers.addProperty("Accept-Encoding","gzip,deflate");



available on: Monday to Friday, Indian standard (day) time : )
  • Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
  • Click "Accept as Solution" if this post was what you needed. so that people who are trying to help will not waste their time reading a thread where no help is needed.

New Contributor
Developer927
Posts: 6
Registered: ‎06-30-2011
My Device: Torch

Re: Does the BrowserField2 support GZIP?

Thanks for the reply. I actually tried that. Below is a snippet of code that I currently have in place. It's passing the header correctly, and the server is responding by sending the data compressed... it just seems the browserfield isn't decoding it correctly. It's just displaying a bunch of strange characters. Clearly, I am missing something???

 

HttpHeaders headers = new HttpHeaders();

headers.addProperty("Content-Type","text/html");

headers.addProperty("Accept-Encoding","gzip");

 

myBrowserFieldConfig.setProperty(BrowserFieldConfig.HTTP_HEADERS, headers);

 

 

Developer
ankityadav4u
Posts: 231
Registered: ‎03-16-2011
My Device: 9700, 9550, and JDE

Re: Does the BrowserField2 support GZIP?

have u tried setting user agent also....................


available on: Monday to Friday, Indian standard (day) time : )
  • Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
  • Click "Accept as Solution" if this post was what you needed. so that people who are trying to help will not waste their time reading a thread where no help is needed.

Developer
ankityadav4u
Posts: 231
Registered: ‎03-16-2011
My Device: 9700, 9550, and JDE

Re: Does the BrowserField2 support GZIP?

it is also possible that server was not properly sending compressed data so check this page in ur program

http://betterexplained.com/examples/compressed/index.php


available on: Monday to Friday, Indian standard (day) time : )
  • Give kudos by clicking on the star icon to say "Thanks!" if you feel this response is helpful.
  • Click "Accept as Solution" if this post was what you needed. so that people who are trying to help will not waste their time reading a thread where no help is needed.

New Contributor
Developer927
Posts: 6
Registered: ‎06-30-2011
My Device: Torch

Re: Does the BrowserField2 support GZIP?

I had not tried that previously. Thank you for the suggestion.

 

I just tried it (code below), but unfortunately, I was met with the same crazy characters. I'm pretty sure the data is being sent properly because the built-in Blackberry Browser is working, and it's receiving the gzipped version of the site.

 

ApplicationDescriptor desc = ApplicationDescriptor.currentApplicationDescriptor();

if (desc != null)

{

    String name = desc.getName();

    String version = desc.getVersion();

 

    //Default = BlackBerry Browser's User Agent

    myBrowserFieldConfig.setProperty(BrowserFieldConfig.USER_AGENT, name + " " + version);

}

 

I'm at a loss. What I thought was so easy is not proving to be. I had zero issues with the Android or iPhone versions. Boo. :smileysurprised:(