|
[
Permlink
| « Hide
]
Eric Hauser added a comment - 21/Jul/04 11:28 AM
Struts also has a nice feature that allows you to declare a handler for an exception. This is a nice feature since it allows you some flexability on what you want to do with the exception, instead of just forwarding the exception to a page.
I don't see why we need this if you can already do it in web.xml -- provided that WebWork throws the source exception out to the container. If it doesn't, we might want to fix that.
web.xml only allows you to assign a page to a particular exception or error code. This approach allows for you to do something programmatically when an error occurs (instead of hacking it into the JSP error page). Something I did in Struts was have it page me everytime a particular exception happened.
This same functionality can be implemented using an interceptor. What I do now is just wrap the action invocation in a try/catch block. Of course, then I have to check and make sure that the exception is of the right type I am trying to catch. If xwork is supposed to be completely independent of the web container, then it seems to make sense to implement some sort of error handling in the framework. However, it doesn't seem like too many others are requesting this sort of feature =). I have started to look at what it would take to implement this feature as we already have something similar inhouse. My thought is that an exception should map directly to another action, where the mapping is specified by actionName and namespace (similar to chaining). Unfortunately, this would seem to require a change to xwork.xml.
For some exceptions (such as a few in Acegi), I wonder if it should be possible to redirect back to the original action with the original stack. These two issues are similar and will be addressed in XW 1.1/WW2.2
Jason -- see
Spoke with Matthew about this while he was in town. The plan is to add a generic interceptor to XWork and then add a new type of XML configuration for WebWork that makes it easier to do these types of common things. Ie: we'd add an <exception on="MyException">[some result]</exception> in webwork.xml, but that would really end up being just another interceptor placed at the end of the stack. That means we need both
With the current webwork error handling capabilities, you should be able to accomplish this--even if a custom error handling interceptor is needed.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||