Java Code Examples for com.netflix.zuul.context.RequestContext#getResponseGZipped()

The following examples show how to use com.netflix.zuul.context.RequestContext#getResponseGZipped() . 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: SwaggerBasePathRewritingFilter.java    From flair-registry with Apache License 2.0 7 votes vote down vote up
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 2
Source File: SwaggerBasePathRewritingFilter.java    From java-microservices-examples with Apache License 2.0 6 votes vote down vote up
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 3
Source File: SwaggerBasePathRewritingFilter.java    From okta-jhipster-microservices-oauth-example with Apache License 2.0 6 votes vote down vote up
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 4
Source File: SwaggerBasePathRewritingFilter.java    From e-commerce-microservice with Apache License 2.0 6 votes vote down vote up
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 5
Source File: SwaggerBasePathRewritingFilter.java    From jhipster-registry with Apache License 2.0 6 votes vote down vote up
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 6
Source File: SwaggerBasePathRewritingFilter.java    From tutorials with MIT License 6 votes vote down vote up
@Override
public Object run() {
    RequestContext context = RequestContext.getCurrentContext();

    context.getResponse().setCharacterEncoding("UTF-8");

    String rewrittenResponse = rewriteBasePath(context);
    if (context.getResponseGZipped()) {
        try {
            context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse)));
        } catch (IOException e) {
            log.error("Swagger-docs filter error", e);
        }
    } else {
        context.setResponseBody(rewrittenResponse);
    }
    return null;
}
 
Example 7
Source File: AccessControlFilter.java    From flair-registry with Apache License 2.0 5 votes vote down vote up
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value());
    if (ctx.getResponseBody() == null && !ctx.getResponseGZipped()) {
        ctx.setSendZuulResponse(false);
    }
    log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI());
    return null;
}
 
Example 8
Source File: SwaggerBasePathRewritingFilter.java    From cubeai with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 9
Source File: SwaggerBasePathRewritingFilter.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 10
Source File: AccessControlFilter.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value());
    if (ctx.getResponseBody() == null && !ctx.getResponseGZipped()) {
        ctx.setSendZuulResponse(false);
    }
    log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI());
    return null;
}
 
Example 11
Source File: AccessControlFilter.java    From jhipster-microservices-example with Apache License 2.0 5 votes vote down vote up
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value());
    if (ctx.getResponseBody() == null && !ctx.getResponseGZipped()) {
        ctx.setSendZuulResponse(false);
    }
    log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI());
    return null;
}
 
Example 12
Source File: AccessControlFilter.java    From jhipster-registry with Apache License 2.0 5 votes vote down vote up
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value());
    if (ctx.getResponseBody() == null && !ctx.getResponseGZipped()) {
        ctx.setSendZuulResponse(false);
    }
    log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI());
    return null;
}
 
Example 13
Source File: SwaggerBasePathRewritingFilter.java    From tutorials with MIT License 5 votes vote down vote up
@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;
}
 
Example 14
Source File: AccessControlFilter.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public Object run() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.FORBIDDEN.value());
    if (ctx.getResponseBody() == null && !ctx.getResponseGZipped()) {
        ctx.setSendZuulResponse(false);
    }
    log.debug("Access Control: filtered unauthorized access on endpoint {}", ctx.getRequest().getRequestURI());
    return null;
}