You can create Session on server and share sessionId
in between client and server with each REST call.
First authenticate REST request: /authenticate
. Returns response (as per your client format) with sessionId: ABCDXXXXXXXXXXXXXX
;
Store this sessionId
in Map
with actual session. Map.put(sessionid, session)
or use SessionListener
to create and destroy keys for you;
public void sessionCreated(HttpSessionEvent arg0) {
// add session to a static Map
}
public void sessionDestroyed(HttpSessionEvent arg0) {
// Remove session from static map
}
Get sessionid with every REST call, like URL?jsessionid=ABCDXXXXXXXXXXXXXX
(or other way);
HttpSession
from map using sessionId
;