org.springframework.cloud.netflix.zuul.filters.support.FilterConstants Java Examples
The following examples show how to use
org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorFilter.java From open-capacity-platform with Apache License 2.0 | 5 votes |
@Override public boolean shouldFilter() { // 判断:仅处理post过滤器引起的异常 RequestContext ctx = RequestContext.getCurrentContext(); ZuulFilter failedFilter = (ZuulFilter) ctx.get(FAILED_FILTER); return failedFilter != null && failedFilter.filterType().equals(FilterConstants.POST_TYPE); }
Example #2
Source File: TokenContextFilter.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
/** * filterOrder:通过int值来定义过滤器的执行顺序 * * @return */ @Override public int filterOrder() { // 数字越大,优先级越低 /** * 一定要在 {@link org.springframework.cloud.netflix.zuul.filters.pre.PreDecorationFilter} 过滤器之后执行,因为这个过滤器做了路由 而我们需要这个路由信息来鉴权 * 这个过滤器会将很多我们鉴权需要的信息放置在请求上下文中。故一定要在此过滤器之后执行 */ return FilterConstants.PRE_DECORATION_FILTER_ORDER + 1; }
Example #3
Source File: ZuulResponseFilter.java From open-cloud with MIT License | 5 votes |
/** * */ @Override public Object run() { // 代理后响应日志处理 RequestContext ctx = RequestContext.getCurrentContext(); HttpServletRequest request = ctx.getRequest(); HttpServletResponse response = ctx.getResponse(); // 把路由的serviceId放入作用域 request.setAttribute(FilterConstants.SERVICE_ID_KEY, ctx.get(FilterConstants.SERVICE_ID_KEY)); accessLogService.sendLog(request, response,null); return null; }
Example #4
Source File: GrayPreZuulFilter.java From spring-cloud-gray with Apache License 2.0 | 5 votes |
@Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); HttpServletRequest servletRequest = context.getRequest(); String serviceId = (String) context.get(FilterConstants.SERVICE_ID_KEY); if (StringUtils.isEmpty(serviceId)) { return null; } GrayHttpRequest grayRequest = new GrayHttpRequest(); URI uri = URI.create((String) context.get(FilterConstants.REQUEST_URI_KEY)); grayRequest.setUri(uri); grayRequest.setServiceId(serviceId); grayRequest.addParameters(context.getRequestQueryParams()); if (grayRequestProperties.isLoadBody()) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(context.getRequest().getInputStream())); byte[] reqBody = IOUtils.toByteArray(reader); grayRequest.setBody(reqBody); } catch (IOException e) { String errorMsg = "获取request body出现异常"; log.error(errorMsg, e); } } grayRequest.setMethod(servletRequest.getMethod()); grayRequest.setHeaders(getHeaders(context)); grayRequest.setAttribute(GRAY_REQUEST_ATTRIBUTE_NAME_ZUUL_REQUEST, servletRequest); grayRequest.setAttribute(GRAY_REQUEST_ATTRIBUTE_NAME_ZUUL_REQUEST_CONTEXT, context); //context.getZuulRequestHeaders().get(FilterConstants.X_FORWARDED_FOR_HEADER.toLowerCase()) RoutingConnectPointContext connectPointContext = RoutingConnectPointContext.builder() .interceptroType(GrayNetflixClientConstants.INTERCEPTRO_TYPE_ZUUL) .grayRequest(grayRequest).build(); routingConnectionPoint.executeConnectPoint(connectPointContext); return null; }
Example #5
Source File: EnvironmentForward.java From pulsar-manager with Apache License 2.0 | 4 votes |
@Override public int filterOrder() { return FilterConstants.SEND_FORWARD_FILTER_ORDER; }
Example #6
Source File: AuthenticationFilter.java From DBus with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #7
Source File: AuthFilter.java From mini-platform with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #8
Source File: RateLimitPreFilterTest.java From spring-cloud-zuul-ratelimit with Apache License 2.0 | 4 votes |
@Test public void testFilterOrder() { assertThat(target.filterOrder()).isEqualTo(FilterConstants.FORM_BODY_WRAPPER_FILTER_ORDER); }
Example #9
Source File: CustomPreZuulFilter.java From spring-security-oauth with MIT License | 4 votes |
@Override public int filterOrder() { return FilterConstants.PRE_DECORATION_FILTER_ORDER + 1; }
Example #10
Source File: PreLimiterZuulFilter.java From onetwo with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #11
Source File: PreLimiterZuulFilter.java From onetwo with Apache License 2.0 | 4 votes |
@Override public int filterOrder() { return FilterConstants.FORM_BODY_WRAPPER_FILTER_ORDER; }
Example #12
Source File: PostLimiterZuulFilter.java From onetwo with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.POST_TYPE; }
Example #13
Source File: PostLimiterZuulFilter.java From onetwo with Apache License 2.0 | 4 votes |
@Override public int filterOrder() { return FilterConstants.SEND_RESPONSE_FILTER_ORDER - 10; }
Example #14
Source File: MyFilter.java From blog-examples with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #15
Source File: MyFilter.java From blog-examples with Apache License 2.0 | 4 votes |
@Override public int filterOrder() { return FilterConstants.PRE_DECORATION_FILTER_ORDER - 1; }
Example #16
Source File: RateLimitPreFilterTest.java From spring-cloud-zuul-ratelimit with Apache License 2.0 | 4 votes |
@Test public void testFilterType() { assertThat(target.filterType()).isEqualTo(FilterConstants.PRE_TYPE); }
Example #17
Source File: RemoteUriRedirectFilter.java From mini-platform with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.ROUTE_TYPE; }
Example #18
Source File: DecodePasswordFilter.java From pig with MIT License | 4 votes |
@Override public int filterOrder() { return FilterConstants.SEND_ERROR_FILTER_ORDER + 2; }
Example #19
Source File: EncodedCharactersFilter.java From api-layer with Eclipse Public License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #20
Source File: ErrorFilter.java From mini-platform with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.ERROR_TYPE; }
Example #21
Source File: TraceFilter.java From zuihou-admin-cloud with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #22
Source File: AuthFilter.java From xmfcn-spring-cloud with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #23
Source File: ValidateCodeFilter.java From pig with MIT License | 4 votes |
@Override public int filterOrder() { return FilterConstants.SEND_ERROR_FILTER_ORDER + 1; }
Example #24
Source File: ErrorExtFilter.java From xmfcn-spring-cloud with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.ERROR_TYPE; }
Example #25
Source File: AccessFilter.java From fw-cloud-framework with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #26
Source File: DecodePasswordFilter.java From pig with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #27
Source File: GrayPreZuulFilter.java From spring-cloud-gray with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #28
Source File: GrayPostZuulFilter.java From spring-cloud-gray with Apache License 2.0 | 4 votes |
@Override public String filterType() { return FilterConstants.POST_TYPE; }
Example #29
Source File: PreviewFilter.java From pig with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }
Example #30
Source File: AccessFilter.java From pig with MIT License | 4 votes |
@Override public String filterType() { return FilterConstants.PRE_TYPE; }