java - How can I store information in the context of a web service? -


I use a web service which is responsible for user login. If a login is successful, the token generated should be done. The public string login (@QueryParam ("userName") is the name of the string, @ kyaparm ("password") strings

  @GET @Produces (MediaType.TEXT_PLAIN) @ path ("/ login") Password) {// Spring Security Check HTTP Response R = Logan Response (name, password); String s = r.getFirstHeader ("location"). ToString (); Boolean is error = s.contains ("login_error"); If (! Error is) {// Tudo Store Tokens in the application reference MD5 token = new MD5 (name + System.currentTimeMillis ()); Return "Token:" + token.getMD5 (); } Return "unsuccessful"; }   

I want to store token in the application context, but I do not know how the token should be present until the server application is running. Does the web service have its own application reference? Should I use any type of HTTP sublet to store information?

Store it, you can apply it using some termination policy, and when you have If there are more than one server, then there will be a problem for storing it in local storage; store it in global cache like a memorycat is more aperitative.

Comments