This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
How can i use an existing jsessionid, when i make a http call.. When a first call is made to the application, we get a jsessionid, i want to use the same jsessionid, when we make next calls and how do i use it on the server side to identify it on the server side, with this jsessionid, i want to access all those objects which have been created for that jsessionid..
These calls are not context specific, we are making absolute HTTP calls..
Any help would be highly appreciated.. Thanx in Advace.
Sridhar, The jsessionid is a unique identifier that is used by the web container as a pointer to your session. As such, the session id is usually persisted on the client and retrieved by the server either through a cookie or through URL rewriting. The first time you create a session on the server, a session id is returned to the client. You must pass this to the server for subsequent calls. How you pass this depends on how the server expects to receive it. If it was part of a cookie, you will need to send it back as part of the "Cookie" header. If it was through URL rewriting, you will need to set it as part of the query string. For the second part of your question there is no way to explicitly retrieve a handle to a session knowing the session id. This was previously possible via the getSession() method on the HttpSessionContext class. As of Servlet API 2.1, this class is deprecated for security reasons. In my opinion you have two options 1. Try and retrieve the session ID on your client side and send it back to the server. On the server side use sessions normally (request.getSession()). If you use a standard client library like Apache common's HTTPClient, this should happen very cleanly. 2. Use your own session identifier and manage the sessions yourself on the server independant of the container's session management. I think this is a very dirty way to do things.