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
Visitor
Posts: 1
Registered: ‎08-29-2012
My Device: 9700
My Carrier: Airtel

Not getting 303 response

Hi All,

 

I have a very strange problem. When I use standard HTTPConnection I am expecting the response code as 303 with Location header because server is having redirection response. But unfortunately I am not getting that. Instead of that it goes to the redirected URL and give me directly response code as 200 with the content on the next URL.

This is happening with SDK 6.0 and above. The sample code as

 

Httpconnection conn = (HttpConnection) Connector.open(url, Connector.READ_WRITE);

//set headers

int code = conn.getResponseCode();

 

I need the response code 303 because the redirected URL is a video URL and reading the content of that is not feasible because it is too large. I want to handle the response code 303 when received and when some pattern is matched with the URL I'll to launch the Browser so that video can be played easily.

 

Any suggestions

 

[Vishal]

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

Re: Not getting 303 response

welcome to the support forums.

if the server gives you an incorrect reply you should look at the server.
maybe it has some special handling for mobile devices that you could fool by a different user agent or something.
----------------------------------------------------------
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