struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mitchell, Steven" <>
Subject RE: Interceptor - Conditional "Redirect" to alternate action
Date Mon, 08 Jun 2009 14:36:58 GMT
Oh, wow, that's incredibly simple.  I was making it too complicated in my mind, thinking I
needed to tell the ActionInvocation class not to allow the original action to fire. 

I see now that the answer was right there in the API "[Interceptor.intercept()] - Allows the
Interceptor to... short-circuit the processing and just return a String return code."

-----Original Message-----
From: Wes Wannemacher [] 
Sent: Monday, June 08, 2009 9:14 AM
To: Struts Users Mailing List
Subject: Re: Interceptor - Conditional "Redirect" to alternate action

Could you use a global-result?

I would just think up a unique name for the set of conditions that
should cause the redirect. Then, configure that string as a
global-result and write your interceptor to do the check and return
the string if the conditions are met and action.invoke otherwise.


On Mon, Jun 8, 2009 at 10:09 AM, Mitchell,
Steven<> wrote:
> I need to put an interceptor after the cookie interceptor that will send
> the user to a preference page if a preference cookie is missing rather
> than let the desired action fire--like a guard condition. If I was using
> a Filter I would just do a redirect.
> Eventually I will also add a Flash shared object as a back-up to the
> cookie, so I'll need to put a Flash shared object interceptor in the
> stack too. The "redirector" interceptor would check the cookie and flash
> token values put set by the previous interceptors in the stack. If both
> are missing, then a different action needs to fire.
> Where can I find an example of an interceptor that conditionally
> "redirects" the user to an alternate action? I'm having trouble
> picturing how the plumbing would work and I think an example of this
> kind would be a big help.
> Steve Mitchell
> ------------------------------------------------------------------------------
> NOTICE:  This electronic mail message and any attached files are confidential.  The
information is exclusively for the use of the individual or entity intended as the recipient.
 If you are not the intended recipient, any use, copying, printing, reviewing, retention,
disclosure, distribution or forwarding of the message or any attached file is not authorized
and is strictly prohibited.  If you have received this electronic mail message in error,
please advise the sender by reply electronic mail immediately and permanently delete the original
transmission, any attachments and any copies of this message from your computer system. Thank
> ==============================================================================
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message