io.netty.handler.codec.http.HttpResponse.getDecoderResult()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中io.netty.handler.codec.http.HttpResponse.getDecoderResult()方法的一些代码示例,展示了HttpResponse.getDecoderResult()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpResponse.getDecoderResult()方法的具体详情如下:
包路径:io.netty.handler.codec.http.HttpResponse
类名称:HttpResponse
方法名:getDecoderResult

HttpResponse.getDecoderResult介绍

暂无

代码示例

代码示例来源:origin: com.hotels.styx/styx-client

if (nettyResponse.getDecoderResult().isFailure()) {
  emitResponseError(new BadHttpResponseException(origin, nettyResponse.getDecoderResult().cause()));
  return;

代码示例来源:origin: HotelsDotCom/styx

if (nettyResponse.getDecoderResult().isFailure()) {
  emitResponseError(new BadHttpResponseException(origin, nettyResponse.getDecoderResult().cause()));
  return;

代码示例来源:origin: apache/tajo

return;
} else if (response.getStatus().code() != HttpResponseStatus.OK.code()) {
 LOG.error(response.getStatus().reasonPhrase(), response.getDecoderResult().cause());
 endFetch(FetcherState.FETCH_FAILED);
 return;

代码示例来源:origin: io.reactivex/rxnetty

eventsSubject.onEvent(HttpClientMetricsEvent.RESPONSE_HEADER_RECEIVED);
HttpResponse response = (HttpResponse) msg;
DecoderResult decoderResult = response.getDecoderResult();
if (decoderResult.isFailure()) {
  ctx.channel().attr(DISCARD_CONNECTION).set(true); // Netty rejects all data after decode failure.

代码示例来源:origin: chengdedeng/waf

@Override
protected ConnectionState readHTTPInitial(HttpResponse httpResponse) {
  LOG.debug("Received raw response: {}", httpResponse);
  if (httpResponse.getDecoderResult().isFailure()) {
    LOG.debug("Could not parse response from server. Decoder result: {}", httpResponse.getDecoderResult().toString());
    // create a "substitute" Bad Gateway response from the server, since we couldn't understand what the actual
    // response from the server was. set the keep-alive on the substitute response to false so the proxy closes
    // the connection to the server, since we don't know what state the server thinks the connection is in.
    FullHttpResponse substituteResponse = ProxyUtils.createFullHttpResponse(HttpVersion.HTTP_1_1,
        HttpResponseStatus.BAD_GATEWAY,
        "Unable to parse response from server");
    HttpHeaders.setKeepAlive(substituteResponse, false);
    httpResponse = substituteResponse;
  }
  currentFilters.serverToProxyResponseReceiving();
  rememberCurrentResponse(httpResponse);
  respondWith(httpResponse);
  if (ProxyUtils.isChunked(httpResponse)) {
    return AWAITING_CHUNK;
  } else {
    currentFilters.serverToProxyResponseReceived();
    return AWAITING_INITIAL;
  }
}

代码示例来源:origin: net.lightbody.bmp/littleproxy

@Override
protected ConnectionState readHTTPInitial(HttpResponse httpResponse) {
  LOG.debug("Received raw response: {}", httpResponse);
  if (httpResponse.getDecoderResult().isFailure()) {
    LOG.debug("Could not parse response from server. Decoder result: {}", httpResponse.getDecoderResult().toString());
    // create a "substitute" Bad Gateway response from the server, since we couldn't understand what the actual
    // response from the server was. set the keep-alive on the substitute response to false so the proxy closes
    // the connection to the server, since we don't know what state the server thinks the connection is in.
    FullHttpResponse substituteResponse = ProxyUtils.createFullHttpResponse(HttpVersion.HTTP_1_1,
        HttpResponseStatus.BAD_GATEWAY,
        "Unable to parse response from server");
    HttpHeaders.setKeepAlive(substituteResponse, false);
    httpResponse = substituteResponse;
  }
  currentFilters.serverToProxyResponseReceiving();
  rememberCurrentResponse(httpResponse);
  respondWith(httpResponse);
  if (ProxyUtils.isChunked(httpResponse)) {
    return AWAITING_CHUNK;
  } else {
    currentFilters.serverToProxyResponseReceived();
    return AWAITING_INITIAL;
  }
}

相关文章