You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Hamacher <th...@qualiads.de> on 2006/08/28 16:44:14 UTC
Struts 1.3.5: Forward out of ComposableRequestProcessor-action
Hi everyone,
I just played around a little bit with Struts 1.3.5 and did some nice tests
with the new ComposableRequestProcessor, which is definately an improvement
against the usual RequestProcessor! Compliments to the developers!
But now I came to a question: I created my own AuthorizeAction, which extends
the AbstractAuthorizeAction and inserted it successfully in the chain through
my own chain-config.xml.
My current implementation is close to the default struts-implementation, so
the "UnauthorizedActionException" is thrown, if the user is not allowed to
access this action. But in this case the tomcat shows an error 500 with the
given error-messages. What I´d like better is, that I create a new
ActionMessage telling the user that he is not allowed to access this page,
add this message to the error-messages in the request-scope and redirect him
back to the page where he came from. This way he only gets a message, but is
not completely thrown to an error page.
What would the way to do this with the ComposableRequestProcessor? Can anyone
give me an example or an idea, how to do this?
Thank you very much
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 1.3.5: Forward out of ComposableRequestProcessor-action
Posted by Wendy Smoak <ws...@gmail.com>.
On 8/28/06, Thomas Hamacher <th...@qualiads.de> wrote:
> My current implementation is close to the default struts-implementation, so
> the "UnauthorizedActionException" is thrown, if the user is not allowed to
> access this action. But in this case the tomcat shows an error 500 with the
> given error-messages. What I´d like better is, that I create a new
> ActionMessage telling the user that he is not allowed to access this page,
> add this message to the error-messages in the request-scope and redirect him
> back to the page where he came from. This way he only gets a message, but is
> not completely thrown to an error page.
>
> What would the way to do this with the ComposableRequestProcessor? Can anyone
> give me an example or an idea, how to do this?
Having never tried it, I'm not certain of the details. How about
configuring an <exception> in struts-config.xml, and providing a
custom ExceptionHandler.
Instead of using the 'path' attribute, have your exception handler
return mapping.getInputForward() which should send you back to the
page with the form. Or if that's not the right place, maybe there is
something else in the request or the available Struts config objects
that will give you enough information to construct an ActionForward to
return.
Nothing here is specific to the ComposableRequestProcessor -- I
haven't had occasion to modify the request processing chain *or* use a
custom Exception handler, so it's quite possible there's a better way
to do it. If nothing else, maybe this message will cause someone to
say, "Don't do that!" :)
http://struts.apache.org/1.x/struts-core/apidocs/org/apache/struts/action/ExceptionHandler.html
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org