2011-04-05 197 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文件就撿起裁判的名字已經被定義,所以我們只是裁判的他們,當我們宣佈我們自己的堆棧