1

I am having the opposite problem of the fellow in this question: Struts 2: excluding method from validation from just the defaultStack interceptor

The above question involved all methods being excluded, my issue is that no methods are being excluded!

I'm trying to get my authenticationInterceptor to ignore the showLogin method of my LoginAction:

<interceptors>
    <interceptor name="authorizationInterceptor" class="org.companyname.struts.interceptor.AuthorizationInterceptor"/>
    <interceptor-stack name="appDefault">
        <interceptor-ref name="authorizationInterceptor"/>
        <interceptor-ref name="defaultStack">
            <param name="exception.logEnabled">true</param>
            <param name="exception.logLevel">ERROR</param>
        </interceptor-ref>              
    </interceptor-stack>
</interceptors>
<default-interceptor-ref name="appDefault" />

<action name="loginInitial" class="org.companyname.struts.action.LoginAction" method="showLogin">
    <interceptor-ref name="appDefault">
        <param name="authorizationInterceptor.excludeMethods">showLogin</param>             
    </interceptor-ref>
    <result name="success">/login.jsp</result>                      
</action>

However, each time I forward to loginInitial, the interceptor grabs it, even though my showLogin method is being excluded.

I've checked for naming issues, and have tried putting several different values in the interceptor-ref within the action, and nothing seems to work.

What's the proper way to skip the authorizationInterceptor when I forward to loginIntial?

Community
  • 1
  • 1
IVR Avenger
  • 15,090
  • 13
  • 46
  • 57
  • 1
    Don't really know anything about your interceptor, so it's impossible to actually help. Is it a `MethodFilterInterceptor`? – Dave Newton Aug 31 '12 at 17:17
  • 1
    What makes you think an `AbtractInterceptor` has an `excludeMethods` parameter? That comes from `MethodFilterInterceptor`. – Dave Newton Sep 09 '12 at 20:58
  • The example I was following detailed the use of an AbstractInterceptor, and showed the excludeMethods properties being acted on. Bad example! – IVR Avenger Nov 01 '12 at 21:44

1 Answers1

1

I believe my issue is the type of interceptor I'm using, the AbstractInterceptor. So, I just use different interceptor stacks on the actions I don't want intercepted:

<interceptor-stack name="appDefaultWithAuth">               
    <interceptor-ref name="defaultStack">
        <param name="exception.logEnabled">true</param>
        <param name="exception.logLevel">ERROR</param>
    </interceptor-ref>              
    <interceptor-ref name="authorizationInterceptor"/>
</interceptor-stack>            

<interceptor-stack name="appDefaultNoAuth">             
    <interceptor-ref name="defaultStack">
        <param name="exception.logEnabled">true</param>
        <param name="exception.logLevel">ERROR</param>
    </interceptor-ref>                  
</interceptor-stack>

<default-interceptor-ref name="appDefaultWithAuth" />

<action name="loginInitial" class="org.company.struts.action.LoginAction" method="showLogin">
    <interceptor-ref name="appDefaultNoAuth"/>              
    <result name="success">/login.jsp</result>                      
</action>
IVR Avenger
  • 15,090
  • 13
  • 46
  • 57