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

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

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

HttpResponse.decoderResult介绍

暂无

代码示例

代码示例来源:origin: line/armeria

if (msg instanceof HttpResponse) {
  final HttpResponse nettyRes = (HttpResponse) msg;
  final DecoderResult decoderResult = nettyRes.decoderResult();
  if (!decoderResult.isSuccess()) {
    fail(ctx, new ProtocolViolationException(decoderResult.cause()));

代码示例来源:origin: com.microsoft.rest.v2/client-runtime

@Override
public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exception {
  if (msg instanceof io.netty.handler.codec.http.HttpResponse) {
    io.netty.handler.codec.http.HttpResponse response = (io.netty.handler.codec.http.HttpResponse) msg;
    if (response.decoderResult().isFailure()) {
      exceptionCaught(ctx, response.decoderResult().cause());
      return;
    }
    responseEmitter.onSuccess(new NettyResponse(response, contentEmitter));
  }
  else if (msg instanceof HttpContent) {
    HttpContent content = (HttpContent) msg;
    contentEmitter.onReceivedContent(content);
    if (msg instanceof LastHttpContent) {
      acquisitionListener.contentDone(false);
    }
  } else {
    exceptionCaught(ctx, new IllegalStateException("Unexpected message type: " + msg.getClass().getName()));
  }
}

代码示例来源:origin: org.wso2.transport.http/org.wso2.transport.http.netty

@Override
public void readInboundResponseHeaders(TargetHandler targetHandler, HttpResponse httpInboundResponse) {
  this.targetHandler = targetHandler;
  OutboundMsgHolder msgHolder = targetHandler.getHttp2TargetHandler()
      .getHttp2ClientChannel().getInFlightMessage(Http2CodecUtil.HTTP_UPGRADE_STREAM_ID);
  if (msgHolder != null) {
    // Response received over HTTP/1.x connection, so mark no push promises available in the channel
    msgHolder.markNoPromisesReceived();
  }
  if (targetHandler.getHttpResponseFuture() != null) {
    HttpCarbonMessage inboundResponseMsg = targetHandler.getInboundResponseMsg();
    inboundResponseMsg.setTargetContext(targetHandler.getContext());
    targetHandler.getHttpResponseFuture().notifyHttpListener(inboundResponseMsg);
  } else {
    LOG.error("Cannot notify the response to client as there is no associated responseFuture");
  }
  if (httpInboundResponse.decoderResult().isFailure()) {
    LOG.warn(httpInboundResponse.decoderResult().cause().getMessage());
  }
}

代码示例来源:origin: io.projectreactor.ipc/reactor-netty

String loggingMsg = msg.toString();
if (msg instanceof HttpResponse) {
  DecoderResult decoderResult = ((HttpResponse) msg).decoderResult();
  if (decoderResult.isFailure()) {
    log.debug(format(ctx.channel(), "Decoding failed: " + msg + " : "),

代码示例来源:origin: com.linkedin.pegasus/r2-netty

if (!m.decoderResult().isSuccess())
 ctx.fireExceptionCaught(m.decoderResult().cause());
 return;

代码示例来源:origin: com.github.mike10004/littleproxy

@Override
protected ConnectionState readHTTPInitial(HttpResponse httpResponse) {
  LOG.debug("Received raw response: {}", httpResponse);
  if (httpResponse.decoderResult().isFailure()) {
    LOG.debug("Could not parse response from server. Decoder result: {}", httpResponse.decoderResult().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");
    HttpUtil.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: reactor/reactor-netty

if (msg instanceof HttpResponse) {
  HttpResponse response = (HttpResponse) msg;
  if (response.decoderResult()
        .isFailure()) {
    onInboundError(response.decoderResult()
                .cause());
    ReferenceCountUtil.release(msg);

代码示例来源:origin: io.projectreactor.netty/reactor-netty

if (msg instanceof HttpResponse) {
  HttpResponse response = (HttpResponse) msg;
  if (response.decoderResult()
        .isFailure()) {
    onInboundError(response.decoderResult()
                .cause());
    ReferenceCountUtil.release(msg);

代码示例来源:origin: io.projectreactor.ipc/reactor-netty

if (msg instanceof HttpResponse) {
  HttpResponse response = (HttpResponse) msg;
  if (response.decoderResult()
        .isFailure()) {
    onInboundError(response.decoderResult()
                .cause());
    ReferenceCountUtil.release(msg);

相关文章