Package io.netty.handler.codec.http

Examples of io.netty.handler.codec.http.DefaultLastHttpContent


    }

    protected void writeLastHttpContent(ChannelHandlerContext ctx, MultipleFutureListener allWritesListener,
                                        HttpClientRequest<?> rxRequest,
                                        final ResponseState responseState) {
        writeAContentChunk(ctx, allWritesListener, new DefaultLastHttpContent())
                .addListener(new ChannelFutureListener() {
                    @Override
                    public void operationComplete(ChannelFuture future) throws Exception {
                        responseState.nowWaitingForResponse();
                    }
View Full Code Here


    public Observable<Void> _close(boolean flush) {

        writeHeadersIfNotWritten();

        if (!fullResponseWritten && (headers.isTransferEncodingChunked() || headers.isKeepAlive())) {
            writeOnChannel(new DefaultLastHttpContent()); // This indicates end of response for netty. If this is not
            // sent for keep-alive connections, netty's HTTP codec will not know that the response has ended and hence
            // will ignore the subsequent HTTP header writes. See issue: https://github.com/Netflix/RxNetty/issues/130
        }
        return flush ? flush() : Observable.<Void>empty();
    }
View Full Code Here

    private ChannelFuture sendLastChunk()
    {
        if (log.isDebugEnabled()) {
            log.debug("send: Sending last HTTP chunk");
        }
        DefaultLastHttpContent chunk = new DefaultLastHttpContent();
        if ((trailers != null) && !isOlderHttpVersion()) {
            for (Map.Entry<String, String> t : trailers) {
                chunk.trailingHeaders().add(t.getKey(), t.getValue());
            }
        }
        ChannelFuture ret = channel.write(chunk);
        return ret;
    }
View Full Code Here

    @Override
    public void setLastChunk(boolean last)
    {
        if (last) {
            chunk = new DefaultLastHttpContent();
        }
    }
View Full Code Here

    super(request, toLastContent(buf));
  }

  private static LastHttpContent toLastContent(ByteBuf buf) {
    if (buf.isReadable()) {
      return new DefaultLastHttpContent(buf, false);
    } else {
      return LastHttpContent.EMPTY_LAST_CONTENT;
    }
  }
View Full Code Here

  @Override
  public synchronized MultiMap trailers() {
    if (trailers == null) {
      if (trailing == null) {
        trailing = new DefaultLastHttpContent(Unpooled.EMPTY_BUFFER, false);
      }
      trailers = new HeadersAdaptor(trailing.trailingHeaders());
    }
    return trailers;
  }
View Full Code Here

      } else {
        LastHttpContent content;
        if (trailing != null) {
          content = new AssembledLastHttpContent(data, trailing.trailingHeaders(), trailing.getDecoderResult());
        } else {
          content = new DefaultLastHttpContent(data, false);
        }
        channelFuture = conn.writeToChannel(content);
      }
    }
View Full Code Here

      if (!headWritten) {
        writeHeadWithContent(buff, end);
      } else {
        if (end) {
          if (buff.isReadable()) {
            conn.writeToChannel(new DefaultLastHttpContent(buff, false));
          } else {
            conn.writeToChannel(LastHttpContent.EMPTY_LAST_CONTENT);
          }
        } else {
          conn.writeToChannel(new DefaultHttpContent(buff));
View Full Code Here

  }

  private static LastHttpContent toLastContent(ByteBuf buf, HttpHeaders trailingHeaders, DecoderResult result) {
    if (buf.isReadable()) {
      if (trailingHeaders == null) {
        return new DefaultLastHttpContent(buf);
      } else {
        return new AssembledLastHttpContent(buf, trailingHeaders, result);
      }
    } else {
      if (trailingHeaders == null) {
View Full Code Here

TOP

Related Classes of io.netty.handler.codec.http.DefaultLastHttpContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.