令牌拦截器和令牌会话拦截器之间的区别? [英] Difference between Token Interceptor and Token Session Interceptor?
问题描述
我知道两个拦截器都用于防止重复提交表单吗?但是,两者之间到底有什么区别? 哪个比其他人更具优势?
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?
推荐答案
tokenSession
扩展了token
拦截器,它们都用于确保每个令牌仅处理一个请求.区别在于对无效令牌的处理.
当发现无效令牌时,token
拦截器仅返回invalid.token
结果.无效令牌上的tokenSession
拦截器将尝试显示与有效令牌情况下相同的响应.
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.
一些用于说明tokenSession
拦截器工作流程的伪代码:
Some pseudo code for illustrating workflow of the tokenSession
interceptor:
intercept() {
if(validToken){
storeInvocation();
return invocation.invoke();
}else {
ActionInvocation storedInvocation = loadStoredInvocation();
// ...
return storedInvocation.getResultCode();
}
}
这篇关于令牌拦截器和令牌会话拦截器之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!