本文整理汇总了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);
}