Link to home
Start Free TrialLog in
Avatar of Sathish David  Kumar N
Sathish David Kumar NFlag for India

asked on

Problem in session

HI ,

I have created a application . in the login screan i put that user name in session. my application is working fine before calling web services .

while i am calling web services i set some values in cokkies , for session id creation .
after successfull call of web services  all session value are null ?
i dont know why ??  
private static String getCookieFromHeaders(HttpURLConnection wsConnection) {                 
     String headerValue = "FAIL";                                                             
     int i = 0;                                                                               
     do {                                                                                     
         String headerName = wsConnection.getHeaderFieldKey(i);                               
         if (headerName != null && headerName.equals("Set-Cookie")) {                         
             headerValue = wsConnection.getHeaderField(i);                                    
             break;                                                                           
         }                                                                                    
         i++;                                                                                 
     } while (true);                                                                          
     return headerValue;                                                                      
 }                                                                                            
                                                                                              
 private static void setSessionIdFromCookie(String sessionString) {                           
     int jsessionIdx = 0;                                                                     
     jsessionIdx = sessionString.indexOf("jsessionid=");                                      
     if (jsessionIdx >= 0) {                                                                  
         sessionString = sessionString.substring(jsessionIdx);                                
         setSessionId(sessionString.substring(11, sessionString.indexOf(";")));               
     }                                                                                        
 }

Open in new window


this two method only call for session creation is this problem .


or iam seeting httpConnection property for cokkies as fasle?

which one is the problem ?l

ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sathish David  Kumar N

ASKER

Problem in my code !!