本文整理匯總了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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}