|
@@ -12,7 +12,7 @@ import com.netflix.zuul.exception.ZuulException;
|
|
|
public class AuthFilter extends ZuulFilter {
|
|
|
|
|
|
@Override
|
|
|
- public Object run() throws ZuulException {
|
|
|
+ public Object run() throws ZuulException {//过滤器核心业务方法
|
|
|
RequestContext requestContext = RequestContext.getCurrentContext();
|
|
|
HttpServletRequest request = requestContext.getRequest();
|
|
|
|
|
@@ -21,17 +21,17 @@ public class AuthFilter extends ZuulFilter {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean shouldFilter() {
|
|
|
+ public boolean shouldFilter() {// 返回true,必须执行过滤器;false,不执行过滤器
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int filterOrder() {
|
|
|
+ public int filterOrder() {// 过滤器的执行顺序,数字越小越先执行
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String filterType() {
|
|
|
+ public String filterType() {// 过滤类型,前置过滤器,后置过滤器
|
|
|
return "pre";
|
|
|
}
|
|
|
|