Javaweb define sortable filter annotations to solve Servlet3.0 @webfilter annotations cannot be sorted.

Source: Internet
Author: User

Com.lwl.anno Gaze type @WebFilterSort

Required Jar Package http://download.csdn.net/detail/u013202238/9431110


The filter with this note is loaded by default in the deployment descriptor, and can be used to change the load order using Ismatchafter
Sort the note for filter, sort starting from 1, 1 highest priority
First run with Url-pattern filtering, servlet-name filtered after all Url-pattern run
setting parameters in Web. xml
< context-param>
< description> the filter to be scanned in the package </description>
< param-name>filterpackage</param-name>
< param-value>com.test.filter.pack</param-value>
</context-param>
Filterpackage required, the smaller the package, the better
Filterinitscanjar Select Fill
Whether to scan the class in the jar package, default feel false does not scan, assuming that does not print can not configure the parameter
Filterinitdebug Select Fill
Whether to print filter initialization information (in sort order), by default false does not print, assuming that the parameter is not printed and can not be configured

      • Summary of required elements
        Required Elements  
        Qualifiers and Types required elements and descriptions
        int valueSort priority
    • Optional element Overview
      optional elements
      Qualifiers and Types optional elements and descriptions
      boolean asyncSupportedDeclares whether the filter supports asynchronous operation mode.
      DispatcherType[] dispatcherTypesThe dispatcher types to which the filter applies
      default {dispatchertype.request};
      java.lang.String displayNameThe display name of the Filter,default ""
      java.lang.String filterNameThe name of the Filter,default ""
      boolean isMatchAfterIndicates the order of the filter relative to the filter in the deployment descriptive descriptor
      Assuming that the parameter used is false, the filter mapping will be loaded before all the filters in the description described in the deployment descriptor are loaded,
      If True (the default), then the filter in the deployment descriptor will be loaded first
      java.lang.String[] servletNamesThe names of the Servlets to which the filter applies.
      java.lang.String[] urlPatternsThe URL patterns to which the filter applies,default {"/*"}
    • Element Specific Information
        • Value
          public abstract int Value
          Sort priority
        • Ismatchafter
          Public abstract Boolean Ismatchafter
          Indicates the order of the filter relative to the filter in the deployment descriptive descriptor
          Assuming that the parameter used is false, the filter mapping will be loaded before all the filters in the description described in the deployment descriptor are loaded,
          If True (the default), then the filter in the deployment descriptor will be loaded first
          Default value:
          True
        • DisplayName
          Public abstract java.lang.String DisplayName
          The display name of the Filter,default ""
          Default value:
          ""
        • FilterName
          Public abstract java.lang.String FilterName
          The name of the Filter,default ""
          Default value:
          ""
        • Servletnames
          Public abstract java.lang.string[] Servletnames
          The names of the Servlets to which the filter Applies.,default {}
          Default value:
          {}
        • Urlpatterns
          Public abstract java.lang.string[] Urlpatterns
          The URL patterns to which the filter applies,default {"/*"}
          Default value:
          "/*"
        • Dispatchertypes
          Public abstract dispatchertype[] Dispatchertypes
          The dispatcher types to which the filter applies
          default {dispatchertype.request};
          Default value:
          <error>
        • asyncsupported
          Public abstract Boolean asyncsupported
          Declares whether the filter supports asynchronous operation mode.
          Default False
          See also:
          javax.servlet.ServletRequest#startAsync, javax.servlet.ServletRequest#startAsync(ServletRequest, ServletResponse)
          Default value:
          False

Javaweb define sortable filter annotations to solve Servlet3.0 @webfilter annotations cannot be sorted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.