Well, the action bean is stored as a request attribute (under key
StripesConstants.REQ_ATTR_ACTION_BEAN), so if your exception occurs after
the action bean resolution, you could just grab it off the request that's
passed to your exception handler.

On Tue, Oct 7, 2008 at 10:50 PM, Simon <[EMAIL PROTECTED]> wrote:

> Hello fellow stripers -
>
> I want to write an exception handler that can take hints from the
> action bean about how to handle errors based on annotations in the
> action bean.    Eg:
>
> class MyAction {
>  @Foo
>  public Resolution doStuff() {
>      ...
>  }
> }
>
> class MyExceptionHandler implements ExceptionHandler {
>  public void handle(...) {
>     Class actionClass = ???;  <=== how to get this???
>     ActionBeanContext ctx = ...;   // I know how to get this
>     Method m = actionClass.getMethod(ctx.getEventName());
>     if(m.isAnnotationPresent(Foo.class)) {
>         ... // <== do something special!
>     }
>  }
> }
>
> However I can't figure out in the exception handler which action
> caused the error.  (I realize it might be more complicated, perhaps
> with jsps or something else in between).    My only idea at the moment
> is to iterate up the stack trace and look for anything that might be
> an action bean.
>
> Any ideas how I can do this?
>
> Cheers,
>
> Simon.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to