Extending TokenInterceptor
smartr <[email protected]> Thu, 28 Dec 2006 19:07:56 CST
| Newsgroups | gmane.comp.java.open-symphony.webwork |
|---|---|
| Message-ID | <22711862.1167354506299.JavaMail.os-j2ee@opensymphony01.managed.contegix.com> |
As opposed to the normal use of a token to prevent double posting, I'm trying to use it to prevent sending the client to the previously displayed page (say, for a central multi-company timeclock). So I extended TokenInterceptor, but it's been giving me issues.
The behavior I'd like to get is to redirect to the previous action when the token is invalid, while retaining a url variable. I'm not too sure about the handling of parameters if the action gets blocked, and I'm not worried about the action actually running on the backend in this case. So I here's what I put into my interceptor:
[code]
protected String handleInvalidToken(ActionInvocation invocation) throws Exception {
// invoke the action to handle parameters.
invocation.invoke();
return INVALID_TOKEN_CODE;
}
[/code]
Now I caught this being called in the debugger when expected, but what is weird - is that WW interpreted the "success" result, not the "invalid.token" result, (even though I stepped onto the return call). I commented out the invoke() code, and it then goes to the "invalid.token" result. Honestly, that would be a better solution if I could just retain the url parameter. I thought I might have been able to do that with
[code]
<param name="excludeMethods">acceptableParameterName, getMyParam, setMyParam</param>[/code]
I also tried that with includeMethods in place of exclude, but neither really achieved what I was hoping for.
I might just end up going at it in an entirely different way, but if you see what's going wrong, that could also be useful.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=55812&messageID=110929#110929