Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are Filter and Listener in Spring Boot

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are Filter and Listener in Spring Boot". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are Filter and Listener in Spring Boot?"

Filter

Filter, also known as filter, is a filter between client and server resource files. It is one of the most exciting technologies in Servlet technology. Web developers manage all resources of the Web server through Filter technology.

When a customer requests access to the URL associated with the filter, the filter executes the doFilter method first. The FilterChain parameter is used to access subsequent filters. The Filter object resides in memory after it is created and is destroyed when the Web application is removed or the server stops. Destroy is called before the Web container unloads the Filter object. This method is executed only once in the life cycle of the Filter.

Filter can have many Filter, one by one, to form a FilterChain, which is what we call a filter chain.

Listener

The listener, also known as Listener, is the listener of Serviet, which can be used to listen to the creation, destruction, addition, modification, deletion and other actions of some objects and information in Web applications, and then make corresponding response processing. When the state of the scope object changes, the server automatically calls the methods in the listener object, which is often used to count the number of online people and online users, initialize the information when the system is loaded, and count the number of visits to the website.

Listeners can be divided into three categories according to the monitoring object: ServletContext (corresponding to application), HttpSession (corresponding to session), and ServletRequest (corresponding to request). There is only one Application in the entire Web service and it is destroyed when the Web service is shut down. Session corresponds to each session, which is created at the beginning of the session and destroyed when one side closes the session. The Request object is created when the customer sends the request (along with Response), which is used to encapsulate the request data and destroy it when a request is processed.

At this point, I believe you have a deeper understanding of "what are Filter and Listener in Spring Boot". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report