On Sun, 7 Jul 2002, Chris Nokleberg wrote:

> Date: Sun, 7 Jul 2002 09:53:09 -0700
> From: Chris Nokleberg <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Implementing canProcess method in RequestDispatcher
>
> I have a servlet 2.3 filter that needs to forward requests based on whether
> they will be eventually be mapped to an action by struts.
>

One approach to this would be to check the URL of the incoming request
against the servlet mapping pattern for the controller servlet -- it's
stored as servlet context attribute Action.SERVLET_KEY
("org.apache.struts.action.SERVLET_MAPPING").

> Ideally there would be
>   boolean canProcess(HttpServletRequest, String uri)
> in RequestProcessor, where URI overrides the one in request unless it
> is null.
>
> I do not mind having to subclass RequestProcessor to implement this.

That seems like a perfectly feasible way to deal with this, because it's
not the kind of thing that everyone (or nearly everyone) needs.

> That would be made much easier, however, if the default implementation
> of processMapping did not call response.sendError when no mapping is
> found. I'd suggest that it just returns null, and the error handling
> code is moved out into the process() method itself.
>

Again, that is something you can do in your custom subclass.

> As it is, I may be able to wrap the response into a dummy object that
> ignores the sendError call, and try to disable the logging of the
> error, but that's quite a hack.
>
> Thanks,
> Chris
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to