|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.web.metaclass.WithFormMethod
class WithFormMethod extends java.lang.Object
Implementation of the "Synchronizer Token Pattern" for Grails that handles duplicate form submissions by inspecting a token stored in the user session.
Method Summary | |
---|---|
protected boolean
|
isTokenValid(GrailsWebRequest webRequest)
Checks whether the token in th request is valid. |
protected java.lang.Object
|
resetToken(GrailsWebRequest webRequest)
Resets the token in the request |
TokenResponseHandler
|
withForm(GrailsWebRequest webRequest, groovy.lang.Closure callable)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
protected boolean isTokenValid(GrailsWebRequest webRequest)
request
- The servlet request
protected java.lang.Object resetToken(GrailsWebRequest webRequest)
TokenResponseHandler withForm(GrailsWebRequest webRequest, groovy.lang.Closure callable)
Main entry point, this method will check the request for the necessary TOKEN and if it is valid will call the passed closure.
For an invalid response an InvalidResponseHandler is returned which will invoke the closure passed to the handleInvalid method. The idea here is to allow code like:
withForm {
// handle valid form submission
}.invalidToken {
// handle invalid form submission
}
Groovy Documentation