当前位置: 首页>>代码示例>>Java>>正文


Java RequestContext.getResponseBody方法代码示例

本文整理汇总了Java中com.netflix.zuul.context.RequestContext.getResponseBody方法的典型用法代码示例。如果您正苦于以下问题:Java RequestContext.getResponseBody方法的具体用法?Java RequestContext.getResponseBody怎么用?Java RequestContext.getResponseBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.netflix.zuul.context.RequestContext的用法示例。


在下文中一共展示了RequestContext.getResponseBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apiLimitExceeded

import com.netflix.zuul.context.RequestContext; //导入方法依赖的package包/类
/**
 * Create a Zuul response error when the API limit is exceeded.
 */
private void apiLimitExceeded() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.TOO_MANY_REQUESTS.value());
    if (ctx.getResponseBody() == null) {
        ctx.setResponseBody("API rate limit exceeded");
        ctx.setSendZuulResponse(false);
    }
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:12,代码来源:RateLimitingFilter.java

示例2: run

import com.netflix.zuul.context.RequestContext; //导入方法依赖的package包/类
@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;
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:11,代码来源:AccessControlFilter.java

示例3: apiLimitExceeded

import com.netflix.zuul.context.RequestContext; //导入方法依赖的package包/类
private void apiLimitExceeded() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.TOO_MANY_REQUESTS.value());
    if (ctx.getResponseBody() == null) {
        ctx.setResponseBody("API rate limit exceeded");
        ctx.setSendZuulResponse(false);
    }
}
 
开发者ID:ElectronicArmory,项目名称:Armory,代码行数:9,代码来源:RateLimitingFilter.java

示例4: apiLimitExceeded

import com.netflix.zuul.context.RequestContext; //导入方法依赖的package包/类
/**
 * Create a Zuul response error when the API limit is exceeded.
 */
private static void apiLimitExceeded() {
    RequestContext ctx = RequestContext.getCurrentContext();
    ctx.setResponseStatusCode(HttpStatus.TOO_MANY_REQUESTS.value());
    if (ctx.getResponseBody() == null) {
        ctx.setResponseBody("API rate limit exceeded");
        ctx.setSendZuulResponse(false);
    }
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:12,代码来源:RateLimitingFilter.java

示例5: responseBodyOf

import com.netflix.zuul.context.RequestContext; //导入方法依赖的package包/类
private String responseBodyOf(RequestContext context) {
  try {
    if (context.getResponseBody() != null) {
      return context.getResponseBody();
    } else {
      return responseBody(context);
    }
  } catch (IOException e) {
    logger.error("Failed to read response body", e);
    context.setResponseStatusCode(SC_INTERNAL_SERVER_ERROR);
    throw new IllegalStateException("Failed to read response body", e);
  }
}
 
开发者ID:ServiceComb,项目名称:ServiceComb-Company-WorkShop,代码行数:14,代码来源:CacheUpdateFilter.java

示例6: isSuccessfulFibonacciResponse

import com.netflix.zuul.context.RequestContext; //导入方法依赖的package包/类
private boolean isSuccessfulFibonacciResponse(RequestContext context, String path) {
  return path.contains(pathInRequest())
      && context.getResponseStatusCode() == SC_OK
      && context.sendZuulResponse()
      && (context.getResponseBody() != null || context.getResponseDataStream() != null);
}
 
开发者ID:ServiceComb,项目名称:ServiceComb-Company-WorkShop,代码行数:7,代码来源:CacheUpdateFilter.java


注:本文中的com.netflix.zuul.context.RequestContext.getResponseBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。