11-28-2013 05:02 AM
My requirement is how and where to maintain the session in application. I below mention my requirements with details
1. Onclick MyApps--> Enter to the login page--> Userid, Pasword(Got sessionid)-->First screen.
2. if once move out or close my application without logout.--> onclick Myapps-->First screen(Directly calls first screen).
3. If logout my session-->Onclick MyApps--> Enter to the login page--> Userid, Pasword(Got sessionid)-->First screen.
how and where to maintain that session value in my apps.
If any one get idea please let me know.
11-28-2013 05:08 AM
Can't you just put the login state in some persistent place and check it when you start your application.
Search on here for additional information if the use of persistent storage is new to you. Or use the java micro site:
11-30-2013 02:11 AM
Thanks for your reply.
Now i got the session and cookie value from my response and write these values in .txt file and stores in my simulator.
When i enters to my apps, read the value from .txt files and pass these values using my url and check the session in my server.
This way is correct to check the session?
But still i didnt get response from server side.
11-30-2013 02:25 AM
once you close your app your session will be expire. you need to create the new session.
For new session you can pass your user data from text file and verify connect with server.
Also verify server create and allow new session with existing user.
12-01-2013 05:59 AM
"This way is correct to check the session?"
Whether it is or not will depend on the way your Server handles the sessions and tokens. So you need to research that and understand what the Server expects.
Because http is a 'stateless' protocol, the state of the session has to be maintained externally, and how this is done will depend on the way the Server has been designed. Where the Server application supports a application interface, the Server will normally return a token - this token will be all you need to confirm the user has logged in. But this token might have a limited life, or you can 'log-out' - in either case the Server application removes the token and it can not be used again. But in this situation, as long as you are within time, your application can continue to use the token. So it is possible for you to store the token, however you want, and recover it for use later, even if your application has been stopped and started.
If you try to use a token once it has 'expired', the Server application will usually return an error message that indicates you are not logged in.
"Plz let me know ia am doing any mistake in this way."
We can't answer this question, because it depends on the Server application. I think what you are doing will work for some applications, but may not work for the one you are are trying to connect to.