[springboot] Servlet filter implementation

insert image description here

1. Filter

1.1 Definitions

Servlet filters are Java classes that can be used in servlet programming for the following purposes:

  • Intercept client requests before they access backend resources.
  • These responses are processed before the server's responses are sent back to the client.

1.2 Usage scenarios

In actual application development, we often use filters to do the following things

  • Based on certain authorization logic, HTTP requests are filtered to ensure the security of data access. For example: determine whether the source IP of the request is in the system blacklist
  • For some encrypted HTTP request data, perform unified decryption to facilitate business processing by back-end resources
  • Or filter sensitive words that are often required in our social applications, or use filters to filter out illegal requests that trigger sensitive words

The main features of the filter are: First, it can filter all requests, and second, it can change the data content of the request.

1.3 Implementation of the filter

Guess you like

Origin blog.csdn.net/hanxiaotongtong/article/details/122892897
Recommended