Spring Cloud是当前炙手可热的微服务开发框架。它的功能强大,组件丰富,设计优雅。目前Spring Cloud还在不断发展之中。
Spring Cloud即将发布Spring Cloud Edgware
版本。该版本解决了不少Bug,新增了不少新特性,本系列博客将为大家详细阐述在Spring Cloud Edgware中新增的特性。
我们知道,过滤器是Zuul的核心。笔者曾经写过两篇文章介绍过滤器:
在Spring Cloud Edgware版本中,新增了/filters
端点。访问该端点即可返回Zuul中当前所有过滤器的详情,并按照类型分类。
如下是 /filters
端点的展示结果,从中,我们可以了解当前Zuul中, error
、post
、pre
、route
四种类型的过滤器分别有哪些,每个过滤器的order
(执行顺序)是多少,以及是否启用等信息。这对于Zuul问题的定位很有用。
{
"error": [
{
"class": "org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter",
"order": 0,
"disabled": false,
"static": true
}
],
"post": [
{
"class": "org.springframework.cloud.netflix.zuul.filters.post.SendResponseFilter",
"order": 1000,
"disabled": false,
"static": true
}
],
"pre": [
{
"class": "org.springframework.cloud.netflix.zuul.filters.pre.DebugFilter",
"order": 1,
"disabled": false,
"static": true
},
{
"class": "org.springframework.cloud.netflix.zuul.filters.pre.FormBodyWrapperFilter",
"order": -1,
"disabled": false,
"static": true
},
{
"class": "org.springframework.cloud.netflix.zuul.filters.pre.Servlet30WrapperFilter",
"order": -2,
"disabled": false,
"static": true
},
{
"class": "org.springframework.cloud.netflix.zuul.filters.pre.ServletDetectionFilter",
"order": -3,
"disabled": false,
"static": true
},
{
"class": "org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter",
"order": 5,
"disabled": false,
"static": true
}
],
"route": [
{
"class": "org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter",
"order": 100,
"disabled": false,
"static": true
},
{
"class": "org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter",
"order": 10,
"disabled": false,
"static": true
},
{
"class": "org.springframework.cloud.netflix.zuul.filters.route.SendForwardFilter",
"order": 500,
"disabled": false,
"static": true
}
]
}
本文链接:Spring Cloud Edgware新特性之五:filters端点
转载声明:本博客由周立创作,采用 CC BY 3.0 CN 许可协议。可*转载、引用,但需署名作者且注明文章出处。如转载至微信公众号,请在文末添加作者公众号二维码。