use of com.netflix.zuul.context.RequestContext in project jhipster-registry by jhipster.
the class SwaggerBasePathRewritingFilter method run.
@Override
public Object run() {
RequestContext context = RequestContext.getCurrentContext();
if (!context.getResponseGZipped()) {
context.getResponse().setCharacterEncoding("UTF-8");
}
String rewrittenResponse = rewriteBasePath(context);
context.setResponseBody(rewrittenResponse);
return null;
}
use of com.netflix.zuul.context.RequestContext in project fw-cloud-framework by liuweijw.
the class ErrorHandlerFilter method run.
@Override
public Object run() {
RequestContext requestContext = RequestContext.getCurrentContext();
logService.send(requestContext);
return null;
}
use of com.netflix.zuul.context.RequestContext in project incubator-skywalking by apache.
the class RewritePathFilter method run.
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
ctx.set(REQUEST_URI, rewritePath);
return null;
}
use of com.netflix.zuul.context.RequestContext in project topcom-cloud by 545314690.
the class AccessFilter method run.
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
log.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString()));
String accessToken = this.getToken(request);
if (accessToken == null) {
accessToken = request.getParameter("accessToken");
}
ctx.getResponse().setContentType("text/html;charset=UTF-8");
if (accessToken == null) {
ctx.setSendZuulResponse(false);
ctx.setResponseStatusCode(401);
// 返回错误内容
ctx.setResponseBody(new ResponseData(401, "accessToken is null").toString());
return null;
} else {
try {
ResponseData responseData = authClient.check(request.getRequestURI(), request.getMethod(), accessToken);
log.info(responseData.toString());
if (!responseData.getStatus()) {
ctx.setSendZuulResponse(false);
ctx.setResponseStatusCode(responseData.getCode());
// 返回错误内容
ctx.setResponseBody(responseData.toString());
return responseData;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
use of com.netflix.zuul.context.RequestContext in project tutorials by eugenp.
the class SimpleFilter method run.
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
log.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString()));
return null;
}
Aggregations