Package io.netty.handler.codec.http

Examples of io.netty.handler.codec.http.HttpContent.content()


        final HttpContent httpContent = ch.readOutbound();
        assertThat(httpContent.content().readableBytes(), is(PreludeFrame.CONTENT_SIZE + 1));
        assertThat(getContent(httpContent.content()), equalTo(expectedContent(PreludeFrame.CONTENT_SIZE)));

        final HttpContent open = ch.readOutbound();
        assertThat(open.content().toString(UTF_8), equalTo("o\n"));

        final HttpContent goAway = ch.readOutbound();
        assertThat(goAway.content().toString(UTF_8), equalTo("c[3000,\"Go away!\"]\n"));
        final HttpContent lastChunk = ch.readOutbound();
        assertThat(lastChunk.content().toString(UTF_8), equalTo(""));
View Full Code Here


        final HttpContent open = ch.readOutbound();
        assertThat(open.content().toString(UTF_8), equalTo("o\n"));

        final HttpContent goAway = ch.readOutbound();
        assertThat(goAway.content().toString(UTF_8), equalTo("c[3000,\"Go away!\"]\n"));
        final HttpContent lastChunk = ch.readOutbound();
        assertThat(lastChunk.content().toString(UTF_8), equalTo(""));
    }

    @Test
View Full Code Here

        assertThat(open.content().toString(UTF_8), equalTo("o\n"));

        final HttpContent goAway = ch.readOutbound();
        assertThat(goAway.content().toString(UTF_8), equalTo("c[3000,\"Go away!\"]\n"));
        final HttpContent lastChunk = ch.readOutbound();
        assertThat(lastChunk.content().toString(UTF_8), equalTo(""));
    }

    @Test
    public void prefixNotFound() throws Exception {
        final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").cookiesNeeded().build();
View Full Code Here

                        NettyResponseHeaders responseHeaders = new NettyResponseHeaders(future.getHttpHeaders(), trailingHeaders);
                        interrupt = handler.onHeadersReceived(responseHeaders) != STATE.CONTINUE;
                    }
                }

                ByteBuf buf = chunk.content();
                try {
                    if (!interrupt && (buf.readableBytes() > 0 || last)) {
                        NettyResponseBodyPart part = nettyConfig.getBodyPartFactory().newResponseBodyPart(buf, last);
                        interrupt = updateBodyAndInterrupt(future, handler, part);
                    }
View Full Code Here

        conn.handleResponse(response);
        valid = true;
      }
      if (msg instanceof HttpContent) {
        HttpContent chunk = (HttpContent) msg;
        if (chunk.content().isReadable()) {
          Buffer buff = new Buffer(chunk.content().slice());
          conn.handleResponseChunk(buff);
        }
        if (chunk instanceof LastHttpContent) {
          conn.handleResponseEnd((LastHttpContent)chunk);
View Full Code Here

        valid = true;
      }
      if (msg instanceof HttpContent) {
        HttpContent chunk = (HttpContent) msg;
        if (chunk.content().isReadable()) {
          Buffer buff = new Buffer(chunk.content().slice());
          conn.handleResponseChunk(buff);
        }
        if (chunk instanceof LastHttpContent) {
          conn.handleResponseEnd((LastHttpContent)chunk);
        }
View Full Code Here

      DefaultHttpServerRequest req = new DefaultHttpServerRequest(this, request, resp);
      handleRequest(req, resp);
    }
    if (msg instanceof HttpContent) {
        HttpContent chunk = (HttpContent) msg;
      if (chunk.content().isReadable()) {
        Buffer buff = new Buffer(chunk.content());
        handleChunk(buff);
      }

      //TODO chunk trailers
View Full Code Here

      handleRequest(req, resp);
    }
    if (msg instanceof HttpContent) {
        HttpContent chunk = (HttpContent) msg;
      if (chunk.content().isReadable()) {
        Buffer buff = new Buffer(chunk.content());
        handleChunk(buff);
      }

      //TODO chunk trailers
      if (msg instanceof LastHttpContent) {
View Full Code Here

            }
            info.handle.event(new State.HeadersReceived(state.resp));
        } else if (msg instanceof HttpContent) {
            HttpContent c = (HttpContent) msg;
            info.handle.event(new State.ContentReceived(c));
            c.content().resetReaderIndex();
            if (c.content().readableBytes() > 0) {
                state.content.writeBytes(c.content());
            }
            state.content.resetReaderIndex();
            boolean last = c instanceof LastHttpContent;
View Full Code Here

            info.handle.event(new State.HeadersReceived(state.resp));
        } else if (msg instanceof HttpContent) {
            HttpContent c = (HttpContent) msg;
            info.handle.event(new State.ContentReceived(c));
            c.content().resetReaderIndex();
            if (c.content().readableBytes() > 0) {
                state.content.writeBytes(c.content());
            }
            state.content.resetReaderIndex();
            boolean last = c instanceof LastHttpContent;
            if (!last && state.resp.headers().get(HttpHeaders.Names.CONTENT_LENGTH) != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.