I Know that both the interceptors are used to prevent duplicate form submissions? But What really are the difference between both of them? Which one has extra edge over other?
Asked
Active
Viewed 5,371 times
3
-
Related: http://stackoverflow.com/a/28717589/1654265 – Andrea Ligios Apr 27 '15 at 09:13
1 Answers
8
The tokenSession
extends token
interceptor, they are both used to ensure that only one request per token is processed. The difference is in the handling of the invalid tokens.
When invalid token is found the token
interceptor just returns invalid.token
result. The tokenSession
interceptor on invalid token will try to display the same response that would have been displayed in case of valid token.
Some pseudo code for illustrating workflow of the tokenSession
interceptor:
intercept() {
if(validToken){
storeInvocation();
return invocation.invoke();
}else {
ActionInvocation storedInvocation = loadStoredInvocation();
// ...
return storedInvocation.getResultCode();
}
}

Aleksandr M
- 24,264
- 12
- 69
- 143
-
Thanks Aleksandr for answering my question. As you said that tokenSession interceptor on invalid token will display the same response as it does on valid token. Could you please elaborate more on this or some UI/picture would be better to understand this point. Thanks! – ankit Oct 23 '13 at 19:24
-
1Look at pseudo code I've given. Imagine there are two request coming one with valid token another with invalid one. When `tokenSession` interceptor intercepts first it stores invocation and when it intercepts second request with invalid token it loads that invocation and shows result to user. – Aleksandr M Oct 24 '13 at 08:04