标签:div esc tostring import and exce ack end tco
package com.example.apigeteway.filter; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletResponse; import java.util.UUID; import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.POST_TYPE; import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.SEND_RESPONSE_FILTER_ORDER; /** * @Title: ResponseFilter * @ProjectName api-geteway * @date 2019/12/1714:19 * @Desc response 处理 */ @Component public class ResponseFilter extends ZuulFilter { @Override public String filterType() { return POST_TYPE; } @Override public int filterOrder() { return SEND_RESPONSE_FILTER_ORDER - 1; } @Override public boolean shouldFilter() { return true; } @Override public Object run() throws ZuulException { RequestContext requestContext = RequestContext.getCurrentContext(); HttpServletResponse response = requestContext.getResponse(); response.setHeader("X-Foo_AAA", UUID.randomUUID().toString()); return null; } }
标签:div esc tostring import and exce ack end tco
原文地址:https://www.cnblogs.com/412013cl/p/12054298.html