[ 
https://issues.apache.org/struts/browse/WW-1817?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mads Riise Rasmussen updated WW-1817:
-------------------------------------


default-interceptor-ref does somehow fulfill my need some of the way, but not 
when I have an action which differ from the default-interceptor-ref. For 
instance it needs paramsPrepareParamsStack instead of basicStack. But if I 
still want to use a specific interceptor for all actions in the package (fx. if 
I want to authenticate all action in package in the same way) I may have to 
specify it again for the action that differs. This explanation may sound a bit 
creepy but let my add a piece of xml below. This is the way I have to do it 
know - what I would like to do is to set the package-user interceptor-stack in 
a new tag <global-interceptor-refs> and let the <default-interceptor-ref> 
contain basicStack or defaultStack and then only specify in this case 
paramsPrepareParamsStack in the to actions where it is used (Hopefully this 
makes a bit of sense =0) and it is only a suggestion of an improvement which 
would make the xml look better):

<package name="user" namespace="/user" extends="struts-default">
  <interceptors>
    <interceptor name="authenticate"
                          
class="com.softscan.service.interceptor.AuthenticateInterceptor" />
      <interceptor-stack name="package-user">
        <interceptor-ref name="authenticate">
          <param name="accessType">2</param>
        </interceptor-ref>
      </interceptor-stack>
    </interceptors>
    <action name="list" 
class="com.softscan.service.controller.user.UserListAction" >
      <interceptor-ref name="package-user" />
      <interceptor-ref name="basicStack" />
      <result>/user/user_list.jsp</result>
    </action>
    <action name="create" >
      <interceptor-ref name="package-user" />
      <result>/user/user_edit.jsp</result>
    </action>
    <action name="edit" 
class="com.softscan.service.controller.user.UserEditAction">
      <interceptor-ref name="package-user" />
      <interceptor-ref name="paramsPrepareParamsStack"/>
      <result>/user/user_edit.jsp</result>
    </action>
    <action name="save" 
class="com.softscan.service.controller.user.UserSaveAction">
      <interceptor-ref name="package-user" />
      <interceptor-ref name="paramsPrepareParamsStack"/>
      <result name="input">/user/user_edit.jsp</result>
      <result type="redirect-action" >list</result>
    </action>
  </package>
</struts>


> A tag <global-interceptor-refs> in <package> is a feature I seem to miss
> ------------------------------------------------------------------------
>
>                 Key: WW-1817
>                 URL: https://issues.apache.org/struts/browse/WW-1817
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Actions
>    Affects Versions: Future
>            Reporter: Mads Riise Rasmussen
>            Priority: Trivial
>
> I think it could be nice with a new sub element in <package> fx. named 
> <global-interceptor-refs> where you could specify the interceptors which 
> should be executed for all action in the given package. Only reason for this 
> is that I don't have to put an <interceptor-ref> in all actions. I guess if 
> it makes sense to have a <global-results> tag it whould also make sense to 
> have a <global-interceptor-refs> tag. Cheers! 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to