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

Web and WebWorks Development

Reply
Contributor
Posts: 14
Registered: ‎06-25-2010
My Device: N/A

Widget - Reading config.xml

Hi,

 

Can someone tell me the proper way to retrieve the value of the customer header field in the config.xml (rim:header attribute) of a BlackBerry Widget?

 

Thanks.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Widget - Reading config.xml

Are you trying to retrieve it in your JavaScript on the device itself?  or are you trying to pick it up on the server?

 

If it is the server, which server technology are you using? (PHP, ASP.NET, .JSP, etc.)

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 14
Registered: ‎06-25-2010
My Device: N/A

Re: Widget - Reading config.xml

Yes..from the server jsp.  I have a widget that does an ajax call to return xml.  I want to verify that the caller is indeed coming from the widget.  Thanks.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Widget - Reading config.xml

Here is a page that shows you how to do this in a variety of different technologies including JSP

 

http://www.developershome.com/wap/detection/detection.asp?page=readHeader

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 14
Registered: ‎06-25-2010
My Device: N/A

Re: Widget - Reading config.xml

So...the rim:header/customer header of a widget will display in the header request from the Blackberry.  I tried that; but not seeing it as an available header when using an emulator.  Does the emulator not pass that widget header?

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Widget - Reading config.xml

From our tests it is passing the header down using the emulator.. can you post the code you are using to read the header information?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Contributor
Posts: 14
Registered: ‎06-25-2010
My Device: N/A

Re: Widget - Reading config.xml

Here's the code in java I'm using to read the header...

Enumeration e = request.getHeaderNames();
     
        while(e.hasMoreElements())
        {
            String name = e.nextElement().toString();
            _LOGGER.log(Level.DEBUG, "HeaderName:" +name + ":" + request.getHeader(name));
            
        }   

 

-Part of my config.xml with the rim: header defined
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.0" rim:header="Test">

 

I would expect to see the rim:header as one of the headers with a value of Test.  That is if I'm understanding how  the config.xml file works...

 

-Here is my header info when I run the app:


[2010-07-13 10:30:42,140] DEBUG:HeaderName:Host:localhost
[2010-07-13 10:30:42,140] DEBUG: HeaderName:Connection:close
[2010-07-13 10:30:42,140] DEBUG:  HeaderName:Accept-Charset:UTF-8,ISO-8859-1,US-ASCII,windows-1251,windows-1252,windows-1253,windows-1254,windows-1255,windows-1256,KOI8-R,windows-1250,UTF-16BE,UTF-16LE
[2010-07-13 10:30:42,140] DEBUG:  HeaderName:content-type:application/x-www-form-urlencoded
[2010-07-13 10:30:42,140] DEBUG:  HeaderName:x-rim-transcode-content:none
[2010-07-13 10:30:42,140] DEBUG:  HeaderName:Accept-Language:en-GB,en;q=0.5
[2010-07-13 10:30:42,140] DEBUG: HeaderName:x-requested-with:XMLHttpRequest
[2010-07-13 10:30:42,140] DEBUG:HeaderName:x-wap-profile:http://www.blackberry.net/go/mobile/profiles/uaprof/9700/5.0.0.rdf
[2010-07-13 10:30:42,156] DEBUG:  HeaderName:User-Agent:BlackBerry9700/5.0.0.545 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/-1
[2010-07-13 10:30:42,156] DEBUG: HeaderName:Accept:application/vnd.rim.html,text/html,application/xhtml+xml,application/vnd.wap.xhtml+xml,application/vnd.wap.wmlc;q=0.9,application/vnd.wap.wmlscriptc;q=0.7,text/vnd.wap.wml;q=0.7,text/vnd.sun.j2me.app-descriptor,image/vnd.rim.png,image/jpeg,application/x-vnd.rim.pme.b,application/vnd.rim.ucs,image/gif;anim=1,application/vnd.rim.jscriptc;v=0-8-72,application/x-javascript,application/vnd.rim.css;v=2,text/css;media=screen,*/*;q=0.5
[2010-07-13 10:30:42,156] DEBUG:HeaderNameSmiley Tonguerofile:http://www.blackberry.net/go/mobile/profiles/uaprof/9700/5.0.0.rdf
[2010-07-13 10:30:42,156] DEBUG:  HeaderName:Content-Length:43