I’m trying to build an Android application in which the client authenticating to the server from the application and after the auth the client sends and receives messages from the server.
my server is google app engine server so i’m using Http request (doPost) for communication.
the goals I have already completed are:
1. creating client profile.
2. sending to the server profile data
3. storing the profile at the server
4. log-in registered profile from the db at the server
5. sending the client ok message for good auth.
now my question is how do I maintain this connection?
because it is http connection after a minute or two i’m not sure the connection will be timed-out. and doing the auth again include accessing the db again seems wrong..
what is the proper way to do this.
code examples or good tutorials will be appreciated.
Thanks.
you can create Http session on server for each client on successful login and for every subsequent request from client just get session already created.
Furthermore, you can persist client specific data in session.Here the linkhttp://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-Session-Tracking.html.
Then you can specify timeout in web.xml on server side. Hope this will help