Glossary

  • Route:网关的基本构建模块。它由 ID、目标 URI、一组谓词和一组过滤器定义。如果聚合谓词为真,则匹配路由。

  • Route: The basic building block of the gateway. It is defined by an ID, a destination URI, a collection of predicates, and a collection of filters. A route is matched if the aggregate predicate is true.

  • Predicate:这是一个 link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/function/RequestPredicate.html[Spring WebMvc.fn RequestPredicate)。输入类型是 link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/function/ServerRequest.html[Spring WebMvc.fn ServerRequest)。这样您就可以匹配 HTTP 请求中的任何内容,例如标头或参数。

  • Predicate: This is a Spring WebMvc.fn RequestPredicate. The input type is a Spring WebMvc.fn ServerRequest. This lets you match on anything from the HTTP request, such as headers or parameters.

  • Filter:这些是 link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/function/HandlerFilterFunction.html[HandlerFilterFunction)的实例。在这里,您可以在发送下游请求之前或之后修改请求和响应。过滤器还可以实现 Function<ServerRequest, ServerRequest>,并且由 link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/function/HandlerFilterFunction.html#ofRequestProcessor(java.util.function.Function)[HandlerFilterFunction.ofRequestProcessor())针对“之前”过滤器进行调整。对于“之后”过滤器,可以通过 link:https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/function/HandlerFilterFunction.html#ofResponseProcessor(java.util.function.BiFunction)[HandlerFilterFunction.ofResponseProcessor())实现并调整 BiFunction<ServerRequest,T extends ServerResponse,R extends ServerResponse>

  • Filter: These are instances of HandlerFilterFunction. Here, you can modify requests and responses before or after sending the downstream request. Filters may also implement Function<ServerRequest, ServerRequest> and adapted to a HandlerFilterFunction by HandlerFilterFunction.ofRequestProcessor() for 'before' filters. For 'after' filters, BiFunction<ServerRequest,T extends ServerResponse,R extends ServerResponse> may be implemented and adapted by HandlerFilterFunction.ofResponseProcessor().