struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken.H...@ubsw.com
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 [mailto:chris@sixlegs.com]
Sent: 07 July 2002 17:53
To: struts-dev@jakarta.apache.org
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.

Thanks,
Chris

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Visit our website at http://www.ubswarburg.com

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:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message