File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Intercepting call in Struts' ActionServlet.process(..) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Intercepting call in Struts Watch "Intercepting call in Struts New topic
Author

Intercepting call in Struts' ActionServlet.process(..)

Sebastian Hinz
Greenhorn

Joined: Nov 06, 2002
Posts: 5
What I really need to do is to intercept some calls in my subclassed
ActionServlet and handle them as if they were directed to another action.
I know, that there are other ways to solve this problem, e.g. subclassing
the RequestProcessor or writing an own action class, from which all my actions
derive. I think the latter approaches have the problem, that I have to
ensure:
1) that all programmers subclass my action class
2) that all programmers have to set my requestProcessor class as the
controller class for their modules
I want to perform some security checks on every single call, so I thought,
best would be to subclass ActionServlet and overwrite the process-method.
Is there a possibilty, that a call to e.g. http://myserver/myapp/foo.do is
changed somehow in my actionservlet's process-method, so that the underlying
controllers think, that http://myserver/myapp/bar.do has been called by the
user?
I tried writing a HttpServletRequestWrapper, overwriting the
getServletPath()-method, because this seems to be the point, where the ActionServlet
determines, which RequestProcessor to choose. This worked out in most cases, but
sometimes failed. Also it seems to be a strange hack and I don't think it's good
style.
Has anybody any idea?
Thank you in advance,
bye Seba
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Intercepting call in Struts' ActionServlet.process(..)