You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Allen, Daniel" <Da...@kbcfp.com> on 2008/02/21 23:26:59 UTC

Extending interceptor stacks

Is there a way to have one interceptor stack defined in terms of
another? I created a log-in interceptor to check if a user is logged in
and redirect him/her to the log-in page if not, and it will be applied
to almost all pages, but there will be a few (index, etc.) that would
not need that. However, most other pages use the same basic
interceptors, just not the log-in one. So, given the below, is there a
way to change it so that it's two stacks, one missing the log-in, and
the other only declaring its parent and adding the log-in?

	<interceptor-stack name="defaultLoginStack">
          <interceptor-ref name="params" />
          <interceptor-ref name="login" />
          <interceptor-ref name="prepare" />
          <interceptor-ref name="fileUpload" />
          <interceptor-ref name="conversionError" />
          <interceptor-ref name="validation" />
	</interceptor-stack>


I'm guessing it's not, since I didn't see anything that seemed likely in
the struts.xml documentation page,[1] but I thought I'd ask and make
sure, or find out if there's some non-XML way of doing an equivalent.
(Or possibly if there's a reason I shouldn't be doing this in the first
place?)

Thanks,
~Dan Allen

[1]http://struts.apache.org/2.x/docs/strutsxml-examples.html

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Extending interceptor stacks

Posted by Dave Newton <ne...@yahoo.com>.
--- "Allen, Daniel" <Da...@kbcfp.com> wrote:
> Is there a way to have one interceptor stack defined in terms of
> another? I created a log-in interceptor to check if a user is logged in
> and redirect him/her to the log-in page if not, and it will be applied
> to almost all pages, but there will be a few (index, etc.) that would
> not need that. However, most other pages use the same basic
> interceptors, just not the log-in one. So, given the below, is there a
> way to change it so that it's two stacks, one missing the log-in, and
> the other only declaring its parent and adding the log-in?
> 
> 	<interceptor-stack name="defaultLoginStack">
>           <interceptor-ref name="params" />
>           <interceptor-ref name="login" />
>           <interceptor-ref name="prepare" />
>           <interceptor-ref name="fileUpload" />
>           <interceptor-ref name="conversionError" />
>           <interceptor-ref name="validation" />
> 	</interceptor-stack>

Not if your added-in interceptor is in the middle of a stack, at least AFAIK.

If the added-in interceptor goes at the beginning or end of an existing stack
then just use the stack-being-extended as one of the interceptor-refs.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org