Filter

1. Routing filter

A route filter is a filter used to route a request based on request attributes when it reaches the gateway.

It determines which background service to send the request to by matching attributes such as the request path, request parameters, and request headers. Route filters are often used to build API gateways in microservice architectures.

Routing filters can help developers aggregate requests from multiple background services into a single entry point, and can rewrite requests, add request headers, and other operations before passing them on. For example, you can use a routing filter to map all user microservice requests to the "/user" path and send the requests to the corresponding user microservice.

The core function of the route filter is route distribution, which determines which background service the request will be passed to and can perform load balancing. Routing filters can also implement advanced functions such as current limiting and fusing.

In Spring Cloud, Zuul is a popular API gateway that provides implementation of route filters. Zuul uses Java-based filters to handle requests, which can be used with other components such as Eureka, Ribbon, and Hystrix to build powerful microservice applications.

2、DefaultFilter

DefaultFilter is a filter used to set default filtering options in an application or system. Unlike global filters, DefaultFilters only apply to a single specific report, view, or query, but they can be set as default options in the application so that they are automatically applied when the user first opens the report or view.

Default filters are commonly used in data management applications, such as spreadsheet and database management tools. They can be used to limit the data sets displayed, set default sorting options, and change other data processing options. Default filters also help ensure data consistency and accuracy because they ensure the same set of rules and filters apply to all users.

For example, in a spreadsheet application, you can set a default filter to display only data within a specific date range. This will ensure that all users see the same data set when viewing the data, allowing for more accurate analysis and decision-making.

3、GlobalFilter

GlobalFilter is a feature in application software that allows users to apply filters to reports or views that apply to all data in the application. This filter is global, meaning it affects all data displayed in the application, regardless of user or department.

Global filters are commonly used in business intelligence and data analysis applications to allow users to analyze large amounts of data efficiently. Global filters also help ensure all users are viewing the same data, reducing conflict analysis and increasing collaboration efficiency.

For example, in a sales reporting application, you can apply a global filter to display all sales data for a specific region or time period. This filter will then apply to all reports and views in the application, allowing users to quickly and easily analyze relevant data.

Guess you like

Origin blog.csdn.net/Isonion/article/details/132736763