You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Derrick Koes <De...@skillsoft.com> on 2006/09/27 23:38:42 UTC
multiple module 403 forward
How can I configure my web app so that each module will forward a 403
error to a different page?
Thanks,
Derrick
Re: multiple module 403 forward
Posted by Niall Pemberton <ni...@gmail.com>.
http://struts.apache.org/1.x/userGuide/building_controller.html#exception_handler
Niall
On 9/28/06, Niall Pemberton <ni...@gmail.com> wrote:
> Either by configuring the module or action for the exception in the
> struts-config.xml
>
> To configure it for the module...
>
> <global-exceptions>
> <exception type="org.apache.struts.chain.commands.UnauthorizedActionException"
> path="/myUnauthorizedAction" />
> </global-exceptions>
>
> ...or for a specific Action...
>
> <action path="/fooAction" type"...">
> <exception type="org.apache.struts.chain.commands.UnauthorizedActionException"
> path="/myUnauthorizedAction" />
> </global-exceptions>
>
> Niall
>
> On 9/28/06, Martin Gainty <mg...@hotmail.com> wrote:
> >
> > How does one redirect or forward to *alternate action* using UnauthorizedActionException
> > Thanks for the info,
> > Martin--
> >
> > ----- Original Message -----
> > From: "Niall Pemberton" <ni...@gmail.com>
> > To: "Struts Users Mailing List" <us...@struts.apache.org>
> > Sent: Wednesday, September 27, 2006 9:01 PM
> > Subject: Re: multiple module 403 forward
> >
> >
> > > On 9/27/06, Derrick Koes <De...@skillsoft.com> wrote:
> > >> How can I configure my web app so that each module will forward a 403
> > >> error to a different page?
> > >
> > > In the Struts 1.2.x series there is nothing to do what you want - the
> > > request processor just uses HttpServletResponse.sendError(403, "User
> > > is not authorized to access action x") - so you can only configure the
> > > webapp as a whole through the web.xml. For 404's you can configure an
> > > "unknown" action for each module - but theres nothing equivalent for
> > > authorization errors. To do this you would need to create your own
> > > custom RequestProcessor implementation and override the processRoles()
> > > method.
> > >
> > > In the Struts 1.3.x series the equivalent Command is the
> > > "AuthorizeAction" which works differently to Struts 1.2.x - instead of
> > > using HttpServletResponse's sendError() method it throws an
> > > "UnauthorizedActionException" - so you can configure an exception
> > > handler on a per-module basis to show different pages.
> > >
> > > Niall
> > >
> > >> Thanks,
> > >> Derrick
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: multiple module 403 forward
Posted by Martin Gainty <mg...@hotmail.com>.
Many Thanks,
M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "Niall Pemberton" <ni...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>; "Martin Gainty" <mg...@hotmail.com>
Sent: Thursday, September 28, 2006 12:00 AM
Subject: Re: multiple module 403 forward
> Either by configuring the module or action for the exception in the
> struts-config.xml
>
> To configure it for the module...
>
> <global-exceptions>
> <exception type="org.apache.struts.chain.commands.UnauthorizedActionException"
> path="/myUnauthorizedAction" />
> </global-exceptions>
>
> ...or for a specific Action...
>
> <action path="/fooAction" type"...">
> <exception type="org.apache.struts.chain.commands.UnauthorizedActionException"
> path="/myUnauthorizedAction" />
> </global-exceptions>
>
> Niall
>
> On 9/28/06, Martin Gainty <mg...@hotmail.com> wrote:
>>
>> How does one redirect or forward to *alternate action* using UnauthorizedActionException
>> Thanks for the info,
>> Martin--
>>
>> ----- Original Message -----
>> From: "Niall Pemberton" <ni...@gmail.com>
>> To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Sent: Wednesday, September 27, 2006 9:01 PM
>> Subject: Re: multiple module 403 forward
>>
>>
>> > On 9/27/06, Derrick Koes <De...@skillsoft.com> wrote:
>> >> How can I configure my web app so that each module will forward a 403
>> >> error to a different page?
>> >
>> > In the Struts 1.2.x series there is nothing to do what you want - the
>> > request processor just uses HttpServletResponse.sendError(403, "User
>> > is not authorized to access action x") - so you can only configure the
>> > webapp as a whole through the web.xml. For 404's you can configure an
>> > "unknown" action for each module - but theres nothing equivalent for
>> > authorization errors. To do this you would need to create your own
>> > custom RequestProcessor implementation and override the processRoles()
>> > method.
>> >
>> > In the Struts 1.3.x series the equivalent Command is the
>> > "AuthorizeAction" which works differently to Struts 1.2.x - instead of
>> > using HttpServletResponse's sendError() method it throws an
>> > "UnauthorizedActionException" - so you can configure an exception
>> > handler on a per-module basis to show different pages.
>> >
>> > Niall
>> >
>> >> Thanks,
>> >> Derrick
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: multiple module 403 forward
Posted by Niall Pemberton <ni...@gmail.com>.
Either by configuring the module or action for the exception in the
struts-config.xml
To configure it for the module...
<global-exceptions>
<exception type="org.apache.struts.chain.commands.UnauthorizedActionException"
path="/myUnauthorizedAction" />
</global-exceptions>
...or for a specific Action...
<action path="/fooAction" type"...">
<exception type="org.apache.struts.chain.commands.UnauthorizedActionException"
path="/myUnauthorizedAction" />
</global-exceptions>
Niall
On 9/28/06, Martin Gainty <mg...@hotmail.com> wrote:
>
> How does one redirect or forward to *alternate action* using UnauthorizedActionException
> Thanks for the info,
> Martin--
>
> ----- Original Message -----
> From: "Niall Pemberton" <ni...@gmail.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Wednesday, September 27, 2006 9:01 PM
> Subject: Re: multiple module 403 forward
>
>
> > On 9/27/06, Derrick Koes <De...@skillsoft.com> wrote:
> >> How can I configure my web app so that each module will forward a 403
> >> error to a different page?
> >
> > In the Struts 1.2.x series there is nothing to do what you want - the
> > request processor just uses HttpServletResponse.sendError(403, "User
> > is not authorized to access action x") - so you can only configure the
> > webapp as a whole through the web.xml. For 404's you can configure an
> > "unknown" action for each module - but theres nothing equivalent for
> > authorization errors. To do this you would need to create your own
> > custom RequestProcessor implementation and override the processRoles()
> > method.
> >
> > In the Struts 1.3.x series the equivalent Command is the
> > "AuthorizeAction" which works differently to Struts 1.2.x - instead of
> > using HttpServletResponse's sendError() method it throws an
> > "UnauthorizedActionException" - so you can configure an exception
> > handler on a per-module basis to show different pages.
> >
> > Niall
> >
> >> Thanks,
> >> Derrick
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: multiple module 403 forward
Posted by Martin Gainty <mg...@hotmail.com>.
How does one redirect or forward to *alternate action* using UnauthorizedActionException
Thanks for the info,
Martin--
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed. If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy. Thank you.
----- Original Message -----
From: "Niall Pemberton" <ni...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, September 27, 2006 9:01 PM
Subject: Re: multiple module 403 forward
> On 9/27/06, Derrick Koes <De...@skillsoft.com> wrote:
>> How can I configure my web app so that each module will forward a 403
>> error to a different page?
>
> In the Struts 1.2.x series there is nothing to do what you want - the
> request processor just uses HttpServletResponse.sendError(403, "User
> is not authorized to access action x") - so you can only configure the
> webapp as a whole through the web.xml. For 404's you can configure an
> "unknown" action for each module - but theres nothing equivalent for
> authorization errors. To do this you would need to create your own
> custom RequestProcessor implementation and override the processRoles()
> method.
>
> In the Struts 1.3.x series the equivalent Command is the
> "AuthorizeAction" which works differently to Struts 1.2.x - instead of
> using HttpServletResponse's sendError() method it throws an
> "UnauthorizedActionException" - so you can configure an exception
> handler on a per-module basis to show different pages.
>
> Niall
>
>> Thanks,
>> Derrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: multiple module 403 forward
Posted by Niall Pemberton <ni...@gmail.com>.
On 9/27/06, Derrick Koes <De...@skillsoft.com> wrote:
> How can I configure my web app so that each module will forward a 403
> error to a different page?
In the Struts 1.2.x series there is nothing to do what you want - the
request processor just uses HttpServletResponse.sendError(403, "User
is not authorized to access action x") - so you can only configure the
webapp as a whole through the web.xml. For 404's you can configure an
"unknown" action for each module - but theres nothing equivalent for
authorization errors. To do this you would need to create your own
custom RequestProcessor implementation and override the processRoles()
method.
In the Struts 1.3.x series the equivalent Command is the
"AuthorizeAction" which works differently to Struts 1.2.x - instead of
using HttpServletResponse's sendError() method it throws an
"UnauthorizedActionException" - so you can configure an exception
handler on a per-module basis to show different pages.
Niall
> Thanks,
> Derrick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org