The original Action that threw the exception ought to be included in the
stack trace.  That wouldn't easily lend itself to auto-parsing though.

You might be able to pass the request URI to teh error-handler with
something like this in struts.xml:

            <result name="error" type="chain">
                <param name="actionName">errorHandler</param>
                <param name="namespace">/</param>
                <param name="method">execute</param>
                <param name="requestUri">${request.requestURI}</param>
            </result>

(making sure that your original action classes have an appropriate public
getRequest() method)

* I haven't tested the above error-handling config, but I am using the
<param name="foo">${bar}</param> format in some other results.

-Brian



On Wed, Jan 27, 2010 at 8:05 AM, CRANFORD, CHRIS
<chris.cranf...@setech.com>wrote:

>
> That doesn't solve my original problem Gabriel.
>
> What I need is a way that I can determine which Action threw the exception
> so that I could include that Request URI in the exception email and logged
> entry.
>
> I think if I use a redirect result type, to Struts when it redirects it is
> considered a new request and thus I loose what the original action was that
> created the exception in the first place.
>
> Hmm - Anyone else have any thoughts or suggestions?
>
> Chris
>
>
> -----Original Message-----
> From: Gabriel Belingueres [mailto:belingue...@gmail.com]
> Sent: Tuesday, January 26, 2010 8:06 PM
> To: Struts Users Mailing List
> Subject: Re: Chain Getting Original URI
>
> (I found the chain result type somewhat problematic, so I avoid it
> every time I can.)
>
> Having said that, if your action ONLY captures the exception, log it,
> email it and then forward the output to an error.jsp page, AND you are
> using Log4J you may find useful to attach more than one appender to
> the log category (one that logs it to some file, and other that emails
> it, see the SMTPAppender), then you could avoid the chained action
> execution.
>
> 2010/1/26 CRANFORD, CHRIS <chris.cranf...@setech.com>:
> >
> > Our Struts2 application has java.lang.Exception mapped to a global
> > result called 'error'.  Our 'error' global result is setup as a CHAIN
> > type to send the user to our ExceptionHandlerAction.  This action is
> > designed to capture the exception, log it, email it to an administration
> > mailbox and then forward the user to our error.jsp page.
> >
> > When ExceptionHandlerAction is invoked, I need to be able to find out
> > what the original request URI was so that it can be included in the log
> > and notification.  Is there a way to get the chain history and get the
> > first action invoked?  If so, could someone explain it to me?
> >
> > I had originally set our base action to implement ServletRequestAware
> > and set the HttpServletRequest object, but unfortunately I was getting
> > NullPointerExceptions with findStaticResource() method.
> >
> > Thoughts?
> > Chris
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to