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 Developer
Posts: 7
Registered: ‎06-24-2009
My Device: Not Specified

Seems like a bug in the API - Retrieving Cookie from BrowserField

Problem Statement : browserField.getCookieManager().getCookie(request.getURL()), this API is not able to retrieve cookie value on 9800 with OS 6.0.0337 and 6.0.0.313.

 

For our application, supported devices are BlackBerry 9900, 9810, 9790 and 9800. Where we are able to retrieve the expected cookie value in 9900, 9810 and 9790 devices as all are with OS version 7.0. But unfortunately we are not able to get that cookie value from 9800 with some particular OS version, like 6.0.0.337, 6.0.0.313. But BlackBerry 9800 with OS version 6.0.0.543 is working as expected.


We did some work around to resolve the issue, but still did not find any solution for that. Bellow is the code snippet which is working for other OS versions but not for OS 6.0.0337 and 6.0.0.313,

1)
<code>
public void documentLoaded(BrowserField browserField, Document document) throws Exception {
        String cookie = browserField.getCookieManager().getCookie(request.getURL());
}
</code>

2)
<code>
ProtocolController controller = new ProtocolController(browserField) {
        public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {

                HttpHeaders httpHeaders = request.getHeaders();
                
                String cookie = browserField.getCookieManager().getCookie(request.getURL());
                System.out.println("Cookie1 value = " + cookie);
                
                System.out.println("BrowserFieldRequest = "+request.getURL());
                System.out.println("HEADER_COOKIE = "+httpHeaders.getPropertyValue(HttpHeaders.HEADER_COOKIE));
                System.out.println("HEADER_COOKIE2 = "+httpHeaders.getPropertyValue(HttpHeaders.HEADER_COOKIE2));
                System.out.println("HEADER_SET_COOKIE = "+httpHeaders.getPropertyValue(HttpHeaders.HEADER_SET_COOKIE));
                System.out.println("HEADER_COOKIE2 = "+httpHeaders.getPropertyValue(HttpHeaders.HEADER_SET_COOKIE2));
                ........
                ........
        }
};
</code>

3)
<code>
config = new MyBrowserFieldConfig();
browserField = new BrowserField(config);


class MyBrowserFieldConfig extends BrowserFieldConfig {
        MyBrowserFieldConfig() {
                ApplicationDescriptor desc = ApplicationDescriptor.currentApplicationDescriptor();
                if (desc != null) {
                        String name = desc.getName();
                        String version = desc.getVersion();
                        setProperty(BrowserFieldConfig.USER_AGENT, name + " " + version);
                }

                setProperty(BrowserFieldConfig.ALLOW_CS_XHR, Boolean.TRUE);
                setProperty(BrowserFieldConfig.ENABLE_GEARS, Boolean.TRUE);
                setProperty(BrowserFieldConfig.NAVIGATION_MODE,
                                BrowserFieldConfig.NAVIGATION_MODE_POINTER);
                setProperty(BrowserFieldConfig.JAVASCRIPT_TIMEOUT, new Integer(1000));
                setProperty(BrowserFieldConfig.HTTP_HEADERS,
                                httpHeaders);
                setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
                setProperty(BrowserFieldConfig.MDS_TRANSCODING_ENABLED, Boolean.FALSE);
                setProperty(BrowserFieldConfig.USER_SCALABLE, Boolean.FALSE);
                setProperty(BrowserFieldConfig.INITIAL_SCALE, new Float(1.5));
                setProperty(BrowserFieldConfig.ENABLE_COOKIES, Boolean.TRUE);
        }
}
</code>

We tried with code snippet 1 and 2 with and without third code snippet. But none of the code base is able to retrieve cookie value from the Browser Field cookie manager for BlackBerry 9800 with OS version 6.0.0.3337.

 

Some additional information, we are using BES/MDS for development and the settings are same for all the device and simulators. The problem is in both the device and simulator. We also checked the MDS setting application.handler.http.CookieSupport by true and false. But no luck.

 

Seeking for help badly, thanks in advance.

 

I also want to draw kind attention of BlackBerry Support team, If someone can check and confirm the exact problem, as we are stuck here.

 

Regards,

Susanta.

New Developer
Posts: 7
Registered: ‎06-24-2009
My Device: Not Specified

Re: Seems like a bug in the API - Retrieving Cookie from BrowserField

Still we did not find any solution, any help from RIM support side also Smiley Sad

 

The only solution, which is working, is to update 9800 OS version from 6.0.0.337 to 6.0.0.543 or 6.0.0.668. But this is not feasible for all the users.

 

Can some one from support team please look into the problem and find sometime to check it's solution?

 

Hope to get some work around. Thanks in advance.

 

-Susanta.