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
Developer
ahmadahmad
Posts: 404
Registered: ‎05-31-2011
My Device: curve
My Carrier: devel
Accepted Solution

httpconnection error

hii, what is the httpConnectionb.getResponseCode(); and what is HttpConnection.HTTP_OK ?

and why should  have (httpConnectionb.getResponseCode() == HttpConnection.HTTP_OK)?

and in wich case we have (httpConnectionb.getResponseCode() != HttpConnection.HTTP_OK)  ?

thanks for any help

 

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: httpconnection error

I think, given the questions you ask, a primer on http communication is required.  Since this is not BlackBerry specific, I recommend that you have a look round the web.  Review the difference between http get and http put, and the sort of response codes that you get from http.  Then I think you will understand what is going on in the Blackberry better.

 

The accurate, but probably useless answers to your questions are:

 

Q: what is the httpConnectionb.getResponseCode();

A: The HTTP response code from the request made by the httpConnection

 

Q: what is HttpConnection.HTTP_OK ?

A: 200

 

Q: why should  have (httpConnectionb.getResponseCode() == HttpConnection.HTTP_OK)?

A: Because otherwise your http request has resulted in response code other than OK and some action is probably required (for example, checking what the code is and act accordingly). 

and in which case we have (httpConnectionb.getResponseCode() != HttpConnection.HTTP_OK) 

Please use plain text.