2011-04-05 152 views
0

在我struts2的XML文件,我看到这个拦截高清:struts2的拦截

<interceptors> 
<interceptor-stack name="dividendinterceptorstack"> 
<interceptor-ref name="servletConfig" /> 
<interceptor-ref name="modelDriven" /> 
</interceptor-stack> 

但如果是用于dividendinterceptorstack定义实际的类?它不在xml中。

回答

1

dividendinterceptorstack是拦截器的堆栈(集合)。

如果你找不到这个堆栈定义 - 你的软件包包含上面的代码片段是从哪里扩展而来的?查看软件包的 层次结构。

+0

谢谢,我发现它 – Victor 2011-04-05 17:45:10

3

拦截器堆栈不是类,它们是以特定顺序运行的拦截器的集合。

0
<interceptors> 
      <interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/> 
      <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/> 
      <interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/> 
      <interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor"/> 
      <interceptor name="cookie" class="org.apache.struts2.interceptor.CookieInterceptor"/> 
      <interceptor name="clearSession" class="org.apache.struts2.interceptor.ClearSessionInterceptor" /> 
      <interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" /> 
      <interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/> 
      <interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/> 
      <interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/> 
      <interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/> 
      <interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/> 
      <interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/> 
      <interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/> 
      <interceptor name="actionMappingParams" class="org.apache.struts2.interceptor.ActionMappingParametersInteceptor"/> 
      <interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/> 
      <interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/> 
      <interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/> 
      <interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/> 
      <interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/> 
      <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/> 
      <interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor"/> 
      <interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/> 
      <interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor"/> 
      <interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/> 
      <interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" /> 
      <interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" /> 
      <interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" /> 
      <interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" /> 
      <interceptor name="jsonValidation" class="org.apache.struts2.interceptor.validation.JSONValidationInterceptor" /> 
      <interceptor name="annotationWorkflow" class="com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor" /> 
      <interceptor name="multiselect" class="org.apache.struts2.interceptor.MultiselectInterceptor" /> 

      <!-- Basic stack --> 
      <interceptor-stack name="basicStack"> 
       <interceptor-ref name="exception"/> 
       <interceptor-ref name="servletConfig"/> 
       <interceptor-ref name="prepare"/> 
       <interceptor-ref name="checkbox"/> 
       <interceptor-ref name="multiselect"/> 
       <interceptor-ref name="actionMappingParams"/> 
       <interceptor-ref name="params"> 
        <param name="excludeParams">dojo\..*,^struts\..*</param> 
       </interceptor-ref> 
       <interceptor-ref name="conversionError"/> 
      </interceptor-stack> 
</interceptors> 

我刚刚从位于支柱核心罐子所以你可以看到拦截的struts-dafault.xml文件就捡起裁判的名字已经被定义,所以我们只是裁判的他们,当我们宣布我们自己的堆栈