struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Implementing canProcess method in RequestDispatcher / struts error handling
Date Tue, 09 Jul 2002 11:19:51 GMT
As a general point, I'd much rather have most of struts not use sendError, rather, just throw
an Exception. This makes an app behave much more like a standard Java app, where exception
propagation can occur as per normal and handled in a centralised manner. 

Is there a reason for always calling sendError? Shouldn't exceptions be handled by the controller?

-----Original Message-----
From: Chris Nokleberg []
Sent: 07 July 2002 17:53
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.

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 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.

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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

Visit our website at

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message