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

Regular Contributor
Posts: 50
Registered: ‎01-05-2011
My Device: 9300
My Carrier: Engineer

HttpConnection returning status code 302


     I am connecting to my Tomcat sever. My system has public ip. So i can access any web appliction remotely. I am connecting to my web server from my application using 





 public class Test_main extends UiApplication { 




public static EditField _logField;


public MainScreen _mainScreen;


HttpConnection conn ;


public static void main(String[] args)





  Test_main app = new Test_main();






public Test_main()




    _mainScreen = new MainScreen();


   _logField = new EditField("Log:", "");









     conn =( HttpConnection)Connector.open  (http://my ip/myapp/index.html);




 _logField.setText(_logField.getText() + "\n  Response is" +    conn.getResponseCode());




catch (Exception e) {


     // TODO: handle exception











It is returning Response 302.Using browser i can connect to the above

link (i.e http://my ip/myapp/index.html). I am using Blackberry model 9300, O.S  5.0.

Please help me.


Thank you







Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: HttpConnection returning status code 302

A response code 302 indicates a redirect - your browser will automatically handle it, but you would need to handle it manually in your application.


The "Location" header of the response should indicate where it is trying to redirect you - you would just make another HttpConnection to that location.

Andrew Cowart | Metova
Posts: 19,623
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection returning status code 302

Posts: 16,643
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: HttpConnection returning status code 302

and if you are looking at peters sample anyhow you can use it to move your connection handling out of the event thread.


feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter