Servlet filter differs from spring interceptor functionality

Source: Internet
Author: User

Servlet Filter and Spring interceptor and functionally similar, can be used for URL rules to go into processing

Order of execution for multiple servlet filter

The order is the order of the configuration of the filter mapping, and the order in which the filter is executed is the order of the filter mapping in Web. Xml.

Execution order of multiple spring interceptor

Spring Interceptor is also the order of execution, but interceptor one more configuration parameter order through which he can also implement interceptor execution order.

The Order of filter and Interceptor

The servlet filter is, of course, executed before the spring interceptor is executed.

Personal feeling Spring Interceptor function is powerful, filter can do things, he can do, and can be requested before, the request after execution, more flexible.

The difference is still a little bit

Filter is mainly for the URL to do a coding thing, filter out the useless parameters, security check (more general, such as login not login, etc.), too thin, or recommend the use of interceptor

Interceptor more, in addition to the above functions, but also to monitor the performance of debugging methods, in the page load, through the Posthandle method to put the common parameter values on some pages.

Servlet filter differs from spring interceptor functionality

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.