BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-28-2008, 02:47 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default HTTP_USER_AGENT - How to declare browser type?

Please Login to Remove!

Hi folks,

I'm not sure I'm asking this question correctly, but does anyone know how to make a "browser field" declare its browser type to the server (in the Java code).

I'm messing with an example distributed with the JDE:
...BlackBerry JDE 4.1.0\samples\com\rim\samples\device\blackberry\br owser\BrowserFieldSampleApplication.java

It works fine for when I use the "www.google.com" url. However, when I try to access one of the pages on my internal site (mySite.com/somePage.htm), it gives me an error message instead of content:

"Couldn't process request as browser type (HTTP_USER_AGENT) is not specified."

So I'm looking through the Developer Guide and the RIM Device Java Library to find a way to explicitly set the HTTP_USER_AGENT / browser type. Two methods look promising to me, but I haven't gotten either of them to work yet. Can anyone look at these and tell me if either one looks like I'm on the right track? (Exposing a great deal of ignorance here ).

Code:
myRenderingSession.getRenderingOptions().setProperty( RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.USER_AGENT, "Blackberry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102");
Code:
myRequestHeaders.setProperty( "HTTP_USER_AGENT", "Blackberry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102");
Side Note: The page on my internal website which is giving me the error message works fine when I access it from the regular blackberry browser. It only gives me the error when I'm trying to access it from a "browser field" in my code. So I'm pretty darn sure that my problem is in my Java code.

Thanks much, if anyone can give me a pointer
Offline  
Old 08-06-2008, 02:37 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2007
Location: Cincinnati, OH
Model: 8700c
PIN: N/A
Carrier: Cingular
Posts: 87
Post Thanks: 0
Thanked 0 Times in 0 Posts
Smile Found it

I'm still not 100% sure if I'm doing this exactly correctly but it appears to be working.

javax.microedition.io.HttpConnection

setRequestProperty()

Code:
myHttpConnection.setRequestProperty( HttpProtocolConstants.HEADER_USER_AGENT, "Blackberry8700/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102" );
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Arrow Hart AC Toggle Switch Senior Quiette 1991 Single Pole Brown Box of 10
$27.5
Arrow Hart AC Toggle Switch Senior Quiette 1991 Single Pole Brown Box of 10 pictureMonowatt knife blade double pole switch 125v porcelian copper
$34.67
Monowatt knife blade double pole  switch 125v porcelian copper picture5 x CARLING Red Lighted Rocker Switch 4 post 3 Position V6D1D66B-ASC00-000-XG
$25.0
5 x CARLING Red Lighted Rocker Switch 4 post 3 Position V6D1D66B-ASC00-000-XG pictureAllen Bradley 802XB7 Limit Switch NSFP ** GENUINE ** AB 802X B7
$356.51
Allen Bradley 802XB7 Limit Switch NSFP ** GENUINE ** AB 802X B7 picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.