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

2*3W 5V DC AMP 5V PAM8403 Mini Digital Power Amplifier Board DC AMP Module
$0.99
2*3W 5V DC AMP 5V PAM8403 Mini Digital Power Amplifier Board DC AMP Module pictureVIASYS EEG Nic36 AMPLIFIER W/LED PCMCIA +MORE NICOLET ONE
$1999.99
VIASYS EEG Nic36 AMPLIFIER W/LED PCMCIA +MORE NICOLET ONE picture100W Discrete Mono Channel Amplifier Board DC 12V Components Design
$17.0
100W Discrete Mono Channel Amplifier Board DC 12V Components Design picture REXROTH AMPLIFIER CARD VT-VSPA1-1-11 NEW NEVER OPENED
$144.0
 REXROTH AMPLIFIER CARD VT-VSPA1-1-11 NEW NEVER OPENED pictureOKUMA E4809-045-061-D40-103 E4809-045-061-D BOARD -0% VAT INVOICE-
$249.99
OKUMA E4809-045-061-D40-103 E4809-045-061-D BOARD -0% VAT INVOICE- picture






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