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
Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: 302 server explanation...

i know i am not good in my work...... since i am dealing with same problem since a week, i am dam frustated..... i am sorry if i violated any rules of this forum... i am attching my network code. 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: 302 server explanation...

I'm sorry, I am still waiting for my questions to answered.  I didn't ask for any source so I am not sure what you have given us here or why.  But rather than explain that can you please answer all my questions. 

Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: 302 server explanation...

hello peter,

At last i solved the problem..... thanks a lot.......After hearing so much of scoldings, u made me to solve the problem.....

It was the issue of cookies.... 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: 302 server explanation...

Excellent!  Smiley Very Happy

 

Can you mark this as solved please.

Highlighted
Super Contributor
Posts: 308
Registered: ‎05-31-2011
My Device: Blackberry-SDK-9800
My Carrier: SimPakage 6.0.0.337_9800 asia.exe

Re: 302 server explanation...

302 error exist because of redirection,

one of the reason of redirection is:

, If u r connected with wifi to simulator, and wifi cannot handle cookies, so you need to hanlde cookies by ur own(use this link)http://www.hccp.org/java-net-cookie-how-to.html....

   and http://bryanallott.net/blog/2010/11/manage-cookies-with-blackberry-java.html..

Form http server response header i extracted the set-cookies--- name=value pair...

 It will be something like this ASP.NET_SessionId=somevalue;path=/;HttpOnly

we need to extract somevalue from (excluding";path=/;HttpOnly") and send it to server next timewhenever u r sending request...

IFu have 2 cookies from server then send both the cookies next time when u sending request...

1stcookiname=>cookiesAuNAm1;

1stcookivalue=>session;

2stcookiname=>cookiesAuNAm22;

2stcookivalue=>Aut;

String myCook = cookiesAuNAm1+"="+session+";"+ cookiesAuNAm22+"="+Aut;

 httpConn.setRequestProperty("Cookie",myCook);