Micro Spring Cloud Services Development: Getting Started, Advanced and source code analysis - 9.5 Spring Cloud Gateway filter factory

9.5 Spring Cloud Gateway filter factory

Filter allows some way modify the HTTP response to the incoming or outgoing HTTP request. The filter may define a specific act on the request path. Spring Cloud Gateway includes many built-in GatewayFilter factory.

GatewayFilter factory above an article on the factories Predicate similar, are configured in the configuration file application.yml, following the convention Greater Than Thought configuration. GatewayFilter Factory eventually respective filter factory class configured in the configuration file processing.

Now pick a few common filter plant to explain.

9.5.1 AddRequestHeader filter plant

AddRequestHeader plant supports two filter parameters, a name attribute is a value for the property. Request for adding a matching header.

1.ch9_5_gateway_filter_addrequestheader

(1) introducing dependent

Parent project has been introduced pom file dependencies.

Listing: ch9_5 / pom.xml


<dependency>
    <groupId>org.springframework.cloud

Guess you like

Origin blog.csdn.net/meteor_93/article/details/104482848