Title: Message
My ExceptionHandlerInterceptor works like this: 
 
When an exception is caught the interceptor sets the Exception into the ActionContext and tries to create an instance of the "error" result and execute it (some refactoring of ActionInvocation would have made this easier).  If it cannot do this (ie no "error" result defined for the action or globally), or another exception is thrown while executing the result then the exception is re-thrown to the container.
 
I define my error handling result to "chain" to an error handling Action. 

<!-- per action or global -->
<result name="error" type="chain">
  <param name="actionName">flightError</param>
</result>

This way the original Action is still on the stack and can be examined by the error page to give a full error report.
 
This functionality must go in an interceptor (or the ServletDispatcher) so that it can surround BOTH the Action.execute() and the Result.execute() calls.  It is adding application specific behaviour which, as previously discussed, should not go in XWork because in many applications there is another layer above XWork that would be better suited to handling exceptions.
 
However, in a WW2 environment there is only the ServletDispatcher above xwork.  The Interceptors and Actions *are* the application.
 
The main advantages of using a "framework integrated" approach over relying on the servlet container error-page mechanism are:
 
1 - Can reference actions defined in the configuration (xwork.xml)
2 - Can report on the current application state in error handler (ie Action still on stack)
 
John.
----- Original Message -----
Sent: Wednesday, November 05, 2003 12:39 AM
Subject: RE: [OS-webwork] ActionInvocation result

Oops... sorry, my bad.
 
Does anyone else have any thoughts on this?
 
I'm not sure about just logging exceptions from an interceptor... I think maybe any exceptions are a problem...
 
I'm also wondering if it's a good idea to catch these exceptions or if it's better to let them get out to the caller (the servlet in the ww2 case) to be handled...
 
Jason
-----Original Message-----
From: John Patterson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 11:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] ActionInvocation result

Getting a bit tired Jason?  Hard work answering all these questions!
 
I was actually asking about the result code returned from the ActionInvocation.invoke() method not the Action.invoke() method.  The later is used to fetch a Result from the action config to execute after the action finishes BUT the former return value is never used.
 
Also, my logic stated that if the result HAS been executed then we can assume that the result HAS been executed (so don't execute another).  If the Action and Result both complete execution then the property is set to true and any exceptions thrown after this point must be thrown from Interceptors.  Correct?
 
I have implemented this interceptor and it seems to work fine (uses 1.4 logging however).  Although it has hardly been put through its paces.  I think it would make a useful addition to XWork.
 
John.
----- Original Message -----
Sent: Tuesday, November 04, 2003 3:30 PM
Subject: RE: [OS-webwork] ActionInvocation result

The result code is mapped to a result based on the configuration (i.e. "success" is mapped to a JSP, etc)
 
I'm not sure of your logic... the executed property is there to tell if the result has been executed (maybe it should be renamed)... If the result has not been executed, it could be either an interceptor that had a problem before executing the Action, or the Action itself, or even the Result, since it's executed before the flag is updated.
 
-----Original Message-----
From: John Patterson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 04, 2003 7:42 AM
To: Webwork
Subject: [OS-webwork] ActionInvocation result

Hi,
 
What is the the purpose of the result code returned from ActionInvocation.invoke()?  I can't find anywhere in the code that it is used?  Also, any comments on my plan to implement an ExceptionHandlerInterceptor like so:
 
ExceptionHandlerInterceptor catches all Exceptions and checks to see if the
invocation has been executed.  If so then the exception must have been
thrown by another interceptor so just log it and do nothing (result has
already finished executing).  Otherwise, use the ActionProxy to create the
ERROR result and execute it.
Thanks,
 
John.

Reply via email to