分布式网关的主要工作是路由及数据交换，在定义时，会经常用到：

| 接口                             | 说明         |
| ------------------- | -------- |
| RouteFilterFactory |  路由过滤器工厂 | 
| RoutePredicateFactory  |  路由检测器工厂 | 
|   |   | 
| CloudGatewayFilter  | 分布式网关过滤器  | 
| CloudGatewayFilterSync  | 分布式网关同步过滤器（用于对接同步 IO）  | 
|   |   | 
| ExFilter  | 交换过滤器  | 
| ExFilterSync | 交换同步过滤器（用于对接同步 IO） |
| ExPredicate  | 交换检测器  | 
|   |   | 
| ExContext  |  交换上下文 | 


### ExFilter

应用场景

* CloudGatewayFilter extends ExFilter
* RouteFilterFactory::cteate()

```java
@FunctionalInterface
public interface ExFilter {
    /**
     * 过滤
     *
     * @param ctx   交换上下文
     * @param chain 过滤链
     */
    Completable doFilter(ExContext ctx, ExFilterChain chain);
}
```

### ExPredicate

应用场景

* RoutePredicateFactory::create() -> ExPredicate

```java
@FunctionalInterface
public interface ExPredicate extends Predicate<ExContext> {
}
```

### ExContext 

| 方法                             | 说明         |
| ------------------- | -------- |
| attr(name)                     | 获取属性     | 
| attrSet(name, value)        | 设置属性     | 
|   |   | 
| target()                      | 路由目标     | 
| targetNew(target)       | 配置路由新目标     | 
| targetNew()               | 路由新目标     | 
|   |   | 
| timeout()                   | 超时配置 |
|   |   | 
| remoteAddress()           | 远程地址     | 
| localAddress()              | 本地地址     | 
| realIp()                       | 客户端真实IP     | 
| isSecure()                    | 是否安全请求（即 ssl）     | 
|   |   | 
| rawMethod()                    | 获取原始请求方法     | 
| rawURI()                    | 获取原始完整请求地址 uri     | 
| rawPath()                    | 原始请求路径     | 
| rawQueryString()           | 获取原始查询字符串     | 
| rawQueryParam(name)   | 获取原始查询参数     | 
| rawQueryParams()         | 获取原始所有查询参数     | 
| rawHeader(name)         | 原始请求头     | 
| rawHeaders()              | 获取原始所有头     | 
| rawCookie(name)          | 原始请求小饼     | 
| rawCookies()              | 获取原始所有小饼      | 
| rawBody()                  | 获取原始请求主体  | 
|   |   | 
| newRequest()  | 新的请求构建器（上面的数据，可按需修改）  | 
| newResponse()   | 新的响应构建器（上面的数据，可按需修改）  | 
|   |   | 
|  toContext()  |  转为经典上下文接口 Context（不带 req-body），用于对接基于 Context 的接口 | 


