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

HTTP transmits incorrectly when User-Agent includes "BlackBerry"

by Retired on ‎02-17-2010 12:09 PM - edited on ‎11-22-2010 07:26 PM by Anonymous (4,162 Views)

Summary

 

This article applies to the following:

  • BlackBerry® smartphones based on Java® technology
  • BlackBerry® Mobile Data System (BlackBerry MDS) Connection Service
  • BlackBerry® Internet Service Browsing (BIS-B)

Background

 

BlackBerry smartphone applications can make Hypertext Transfer Protocol (HTTP) connections to web sites using a variety of data transports. After opening an HTTP connection, and before reading or writing to the connection, request properties can be set. The User-Agent property can be set as follows:

 

 

HttpConnection conn = (HttpConnection) Connector.open(url);
conn.setRequestProperty("User-Agent", "<Custom User Agent String>");

 

Problem

 

Some of the HTTP content is altered or removed when downloading using the BlackBerry MDS or BIS-B transport, where the User-Agent property has been set to include the word "BlackBerry" even if it is included with other text. Such modifications include removing parts of the header and changing special characters, such as '<', to characters that cannot be displayed. This behavior does not occur when connecting with direct Transmission Control Protocol (TCP).

Cause

 

Including the word "BlackBerry" in the User-Agent property, without other BlackBerry smartphone profile information, informs BlackBerry MDS or BIS-B that this is a BlackBerry smartphone based on C++ technology that requires transcoding of the HTTP content. The application receives the transcoded content from BlackBerry MDS or BIS-B and ignores the actual capabilities of the

BlackBerry smartphone.

Resolution

 

Include the BlackBerry smartphone model number and BlackBerry® Device Software version in the User-Agent property. The BlackBerry smartphone profile information should also be sent to BlackBerry MDS or BIS-B. The format for the User-Agent property and profile headers can be found in this article.

 

Alternatively, a property can be specified to disable transcoding. This property is set as follows:

 

 

conn.setRequestProperty("x-rim-transcode-content", "none");

 

For consistency with the BlackBerry smartphone browser and compatibility with all BlackBerry smartphones, make sure that you are using the appropriate User-Agent and profile headers for HTML traffic downloaded over HTTP connections.

 

Contributors
Users Online
Currently online: 24 members 3,671 guests
Please welcome our newest community members: