當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。