public class TokenProcessor extends Object
Modifier | Constructor and Description |
---|---|
protected |
TokenProcessor()
Protected constructor for TokenProcessor.
|
Modifier and Type | Method and Description |
---|---|
String |
generateToken(javax.servlet.http.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(javax.servlet.http.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(javax.servlet.http.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(javax.servlet.http.HttpServletRequest request)
Reset the saved transaction token in the user's session.
|
void |
saveToken(javax.servlet.http.HttpServletRequest request)
Save a new transaction token in the user's current session, creating a
new session if necessary.
|
protected TokenProcessor()
public static TokenProcessor getInstance()
public boolean isTokenValid(javax.servlet.http.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(javax.servlet.http.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(javax.servlet.http.HttpServletRequest request)
request
- The servlet request we are processingpublic void saveToken(javax.servlet.http.HttpServletRequest request)
request
- The servlet request we are processingpublic String generateToken(javax.servlet.http.HttpServletRequest request)
request
- The request we are processingCopyright © 2000–2016 Apache Software Foundation. All rights reserved.