• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sebastian Hinz
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic