|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.util.TokenProcessor
public class TokenProcessor
TokenProcessor is responsible for handling all token related functionality. The methods in this class are synchronized to protect token processing from multiple threads. Servlet containers are allowed to return a different HttpSession object for two threads accessing the same session so it is not possible to synchronize on the session.
Constructor Summary | |
---|---|
protected |
TokenProcessor()
Protected constructor for TokenProcessor. |
Method Summary | |
---|---|
String |
generateToken(HttpServletRequest request)
Generate a new transaction token, to be used for enforcing a single request for a particular transaction. |
String |
generateToken(String id)
Generate a new transaction token, to be used for enforcing a single request for a particular transaction. |
static TokenProcessor |
getInstance()
Retrieves the singleton instance of this class. |
boolean |
isTokenValid(HttpServletRequest request)
Return true if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. |
boolean |
isTokenValid(HttpServletRequest request,
boolean reset)
Return true if there is a transaction token stored in the
user's current session, and the value submitted as a request parameter
with this action matches it. |
void |
resetToken(HttpServletRequest request)
Reset the saved transaction token in the user's session. |
void |
saveToken(HttpServletRequest request)
Save a new transaction token in the user's current session, creating a new session if necessary. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected TokenProcessor()
Method Detail |
---|
public static TokenProcessor getInstance()
public boolean isTokenValid(HttpServletRequest request)
Return true
if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. Returns false
under any of the following circumstances:
request
- The servlet request we are processingpublic boolean isTokenValid(HttpServletRequest request, boolean reset)
true
if there is a transaction token stored in the
user's current session, and the value submitted as a request parameter
with this action matches it. Returns false
request
- The servlet request we are processingreset
- Should we reset the token after checking it?public void resetToken(HttpServletRequest request)
request
- The servlet request we are processingpublic void saveToken(HttpServletRequest request)
request
- The servlet request we are processingpublic String generateToken(HttpServletRequest request)
request
- The request we are processingpublic String generateToken(String id)
id
- a unique Identifier for the session or other context in which
this token is to be used.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |