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: 3
Registered: ‎04-24-2009
My Device: Not Specified

Getting 302 http response code on blackberry 8220

Hello all,

 

I am writing an app that sends an http request. I am not using a data plan, but using the wi-fi connection instead. When I issue this request, I get a 302 response code. Normally these response codes are handled and redirected internally by whatever client software the device has installed. 

 

Does anyone know why I am seeing this? Better yet, can anyone tell me the best way to get around this problem? Am I supposed to do the redirect myself?

 

Here is my code snippet:

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;

.....

connection = (HttpConnection)Connector.open(url);

responseCode = connection.getResponseCode();
 

 

Thanks, Jason

New Developer
Posts: 3
Registered: ‎04-24-2009
My Device: Not Specified

Re: Getting 302 http response code on blackberry 8220

I figured out why I am getting 302 code. My provider is trying to upsell me on to a data plan.

 

My question now is:

 

If I have wifi connection, is there a way to force my httpconnection to use that instead of my provider's data plan?

 

Thanks,

Jason

BlackBerry Development Advisor
Posts: 15,723
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Getting 302 http response code on blackberry 8220

You can append ;interface=wifi to the end of your URL.  Review the following for more information.

 

What Is - Different ways to make an HTTP or socket connection
Article Number: DB-00396
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

 

Network Transports Video
http://www.blackberry.com/DevMediaLibrary/view.do?name=NetworkingTransports

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Highlighted
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Getting 302 http response code on blackberry 8220

Talk to RIM about this- some of their services AFAIK hide all of this but you may not want it.

For example, what does the hiding server do with cookies in the 302 response? Just add them to the

resulting response or send them back with redirect?