本文整理了Java中io.netty.handler.codec.http.HttpResponse.status()
方法的一些代码示例,展示了HttpResponse.status()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.status()
方法的具体详情如下:
包路径:io.netty.handler.codec.http.HttpResponse
类名称:HttpResponse
方法名:status
[英]Returns the status of this HttpResponse.
[中]
代码示例来源:origin: wildfly/wildfly
@Override
public HttpResponseStatus getStatus() {
return ((HttpResponse) message).status();
}
代码示例来源:origin: AsyncHttpClient/async-http-client
/**
* Return the response status code
*
* @return the response status code
*/
public int getStatusCode() {
return response.status().code();
}
代码示例来源:origin: jersey/jersey
@Override
public int getStatusCode() {
return response.status().code();
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
@Deprecated
public HttpResponseStatus getStatus() {
return response.status();
}
代码示例来源:origin: AsyncHttpClient/async-http-client
/**
* Return the response status text
*
* @return the response status text
*/
public String getStatusText() {
return response.status().reasonPhrase();
}
代码示例来源:origin: apache/pulsar
@Override
public boolean keepAlive(Request ahcRequest, HttpRequest request, HttpResponse response) {
// Close connection upon a server error or per HTTP spec
return (response.status().code() / 100 != 5) && super.keepAlive(ahcRequest, request, response);
}
});
代码示例来源:origin: jersey/jersey
@Override
public String getReasonPhrase() {
return response.status().reasonPhrase();
}
}, jerseyRequest);
代码示例来源:origin: Netflix/zuul
private void processResponseFromOrigin(final HttpResponse originResponse) {
if (originResponse.status().code() >= 500) {
handleOriginNonSuccessResponse(originResponse, chosenServer.get());
} else {
handleOriginSuccessResponse(originResponse, chosenServer.get());
}
}
代码示例来源:origin: wildfly/wildfly
private static void appendInitialLine(StringBuilder buf, HttpResponse res) {
buf.append(res.protocolVersion());
buf.append(' ');
buf.append(res.status());
buf.append(StringUtil.NEWLINE);
}
代码示例来源:origin: wildfly/wildfly
private static void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) {
ChannelFuture f = ctx.channel().writeAndFlush(res);
if (!isKeepAlive(req) || res.status().code() != 200) {
f.addListener(ChannelFutureListener.CLOSE);
}
}
代码示例来源:origin: jersey/jersey
@Override
public Response.Status.Family getFamily() {
return Response.Status.Family.familyOf(response.status().code());
}
代码示例来源:origin: Netflix/zuul
public boolean isRetryable5xxResponse(final HttpRequestMessage zuulRequest, HttpResponse originResponse) { // int retryNum, int maxRetries) {
if (isRequestReplayable()) {
int status = originResponse.status().code();
if (status == 503 || originIndicatesRetryableInternalServerError(originResponse)) {
return true;
}
// Retry if this is an idempotent http method AND status code was retriable for idempotent methods.
else if (RETRIABLE_STATUSES_FOR_IDEMPOTENT_METHODS.get().contains(status) && IDEMPOTENT_HTTP_METHODS.contains(zuulRequest.getMethod().toUpperCase())) {
return true;
}
}
return false;
}
代码示例来源:origin: aws/aws-sdk-java
/**
* Dump the Netty {@link HttpResponse} to the SDK {@link com.amazonaws.http.HttpResponse} container.
*
* @param resp Response to adapt.
*/
private void dumpToSdkHttpResponse(HttpResponse resp) {
errorResponse.setStatusCode(resp.status().code());
errorResponse.setStatusText(resp.status().reasonPhrase());
for (Map.Entry<String, String> header : resp.headers().entries()) {
errorResponse.addHeader(header.getKey(), header.getValue());
}
}
代码示例来源:origin: wildfly/wildfly
@Override
protected boolean ignoreContentAfterContinueResponse(Object msg) {
if (msg instanceof HttpResponse) {
final HttpResponse httpResponse = (HttpResponse) msg;
return httpResponse.status().codeClass().equals(HttpStatusClass.CLIENT_ERROR);
}
return false;
}
代码示例来源:origin: Netflix/zuul
private void processResponseFromOrigin(final HttpResponse originResponse) {
if (originResponse.status().code() >= 500) {
handleOriginNonSuccessResponse(originResponse, chosenServer.get());
} else {
handleOriginSuccessResponse(originResponse, chosenServer.get());
}
}
代码示例来源:origin: wildfly/wildfly
@Override
protected void encodeInitialLine(ByteBuf buf, HttpResponse response) throws Exception {
response.protocolVersion().encode(buf);
buf.writeByte(SP);
response.status().encode(buf);
ByteBufUtil.writeShortBE(buf, CRLF_SHORT);
}
代码示例来源:origin: wildfly/wildfly
@Override
protected void sanitizeHeadersBeforeEncode(HttpResponse msg, boolean isAlwaysEmpty) {
if (!isAlwaysEmpty && method == HttpMethod.CONNECT && msg.status().codeClass() == HttpStatusClass.SUCCESS) {
// Stripping Transfer-Encoding:
// See https://tools.ietf.org/html/rfc7230#section-3.3.1
msg.headers().remove(HttpHeaderNames.TRANSFER_ENCODING);
return;
}
super.sanitizeHeadersBeforeEncode(msg, isAlwaysEmpty);
}
代码示例来源:origin: Netflix/zuul
public boolean isRetryable5xxResponse(final HttpRequestMessage zuulRequest, HttpResponse originResponse) { // int retryNum, int maxRetries) {
if (isRequestReplayable()) {
int status = originResponse.status().code();
if (status == 503 || originIndicatesRetryableInternalServerError(originResponse)) {
return true;
}
// Retry if this is an idempotent http method AND status code was retriable for idempotent methods.
else if (RETRIABLE_STATUSES_FOR_IDEMPOTENT_METHODS.get().contains(status) && IDEMPOTENT_HTTP_METHODS.contains(zuulRequest.getMethod().toUpperCase())) {
return true;
}
}
return false;
}
代码示例来源:origin: Netflix/zuul
protected void handleOriginSuccessResponse(final HttpResponse originResponse, Server chosenServer) {
origin.recordSuccessResponse();
if (originConn != null) {
originConn.getServerStats().clearSuccessiveConnectionFailureCount();
}
final int respStatus = originResponse.status().code();
long duration = 0;
if (requestStat != null) {
requestStat.updateWithHttpStatusCode(respStatus);
requestStat.finishIfNotAlready();
duration = requestStat.duration();
}
if (currentRequestAttempt != null) {
currentRequestAttempt.complete(respStatus, duration, null);
}
// separate nfstatus for 404 so that we can notify origins
final StatusCategory statusCategory = respStatus == 404 ? SUCCESS_NOT_FOUND : SUCCESS;
zuulResponse = buildZuulHttpResponse(originResponse, statusCategory, context.getError());
invokeNext(zuulResponse);
}
代码示例来源:origin: Netflix/zuul
protected void handleOriginSuccessResponse(final HttpResponse originResponse, Server chosenServer) {
origin.recordSuccessResponse();
if (originConn != null) {
originConn.getServerStats().clearSuccessiveConnectionFailureCount();
}
final int respStatus = originResponse.status().code();
long duration = 0;
if (requestStat != null) {
requestStat.updateWithHttpStatusCode(respStatus);
requestStat.finishIfNotAlready();
duration = requestStat.duration();
}
if (currentRequestAttempt != null) {
currentRequestAttempt.complete(respStatus, duration, null);
}
// separate nfstatus for 404 so that we can notify origins
final StatusCategory statusCategory = respStatus == 404 ? SUCCESS_NOT_FOUND : SUCCESS;
zuulResponse = buildZuulHttpResponse(originResponse, statusCategory, context.getError());
invokeNext(zuulResponse);
}
内容来源于网络,如有侵权,请联系作者删除!