Package org.jboss.netty.handler.codec.http

Examples of org.jboss.netty.handler.codec.http.HttpChunk


        HttpResponse resp = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.SERVICE_UNAVAILABLE);
        resp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
        sendServerResponse(clientAddr, resp, 2000);

        HttpChunk chunk1 = new DefaultHttpChunk(ChannelBuffers.wrappedBuffer("chunk1".getBytes(Charset.defaultCharset())));
        sendServerResponse(clientAddr, chunk1, 1000);

        sendServerResponse(clientAddr, new DefaultHttpChunkTrailer(), 1000);

        final List<String> callbacks = respProcessor.getCallbacks();
View Full Code Here


        HttpResponse resp = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
        resp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
        sendServerResponse(clientAddr, resp, 2000);

        HttpChunk chunk1 = new DefaultHttpChunk(ChannelBuffers.wrappedBuffer("chunk1".getBytes(Charset.defaultCharset())));
        sendServerResponse(clientAddr, chunk1, 1000);

        sendServerResponse(clientAddr, new DefaultHttpChunkTrailer(), 1000);

View Full Code Here

      HttpResponse resp = (HttpResponse)e.getMessage();
      startHttpResponse(true, resp);
    }
    else if (e.getMessage() instanceof HttpChunk)
    {
      HttpChunk chunk = (HttpChunk)e.getMessage();
      processHttpChunk(true, chunk);
      if (State.OUTBOUND_RESPONSE_END == _state)
      {
        endHttpResponse(true);
      }
View Full Code Here

      HttpResponse resp = (HttpResponse)e.getMessage();
      startHttpResponse(false, resp);
    }
    else if (e.getMessage() instanceof HttpChunk)
    {
      HttpChunk chunk = (HttpChunk)e.getMessage();
      processHttpChunk(false, chunk);
    }
    super.writeRequested(ctx, e);
  }
View Full Code Here

      resp = msgReq.getUri();
    } else if(msgO instanceof HttpResponse){
      HttpResponse msgReq = (HttpResponse)msgO;
      resp = msgReq.toString();
    } else  if(msgO instanceof HttpChunk){
      HttpChunk msgReq = (HttpChunk)msgO;
      resp = msgReq.toString();
    } else {
      ChannelBuffer msg = (ChannelBuffer)msgO;
      byte[] bytes = new byte[msg.capacity()];
      msg.readBytes(bytes);
      msg.setIndex(0, bytes.length);
View Full Code Here

          //send back the /sources response
          HttpResponse sourcesResp = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
                                                             HttpResponseStatus.OK);
          sourcesResp.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
          sourcesResp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
          HttpChunk body =
              new DefaultHttpChunk(ChannelBuffers.wrappedBuffer(("[{\"id\":1,\"name\":\"" +
                                   SOURCE1_NAME + "\"}]").getBytes(Charset.defaultCharset())));
          NettyTestUtils.sendServerResponses(relay, clientAddr, sourcesResp, body);

          //make sure the client processes the response correctly
View Full Code Here

          //send back the /sources response
          HttpResponse sourcesResp = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
                                                             HttpResponseStatus.OK);
          sourcesResp.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
          sourcesResp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
          HttpChunk body =
              new DefaultHttpChunk(ChannelBuffers.wrappedBuffer(("[{\"id\":1,\"name\":\"" +
                                   SOURCE1_NAME + "\"}]").getBytes(Charset.defaultCharset())));
          NettyTestUtils.sendServerResponses(relay, clientAddr, sourcesResp, body);

          //make sure the client processes the response correctly
View Full Code Here

          //send back the /sources response
          HttpResponse httpResp = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
                                                             HttpResponseStatus.OK);
          httpResp.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
          httpResp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
          HttpChunk body =
              new DefaultHttpChunk(ChannelBuffers.wrappedBuffer(("[{\"id\":1,\"name\":\"" +
                                   SOURCE1_NAME + "\"}]").getBytes(Charset.defaultCharset())));
          NettyTestUtils.sendServerResponses(relay, clientAddr, httpResp, body);

          //make sure the client processes the response correctly
View Full Code Here

      //send back the /sources response
      HttpResponse sourcesResp = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
                                                         HttpResponseStatus.OK);
      sourcesResp.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
      sourcesResp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
      HttpChunk body =
          new DefaultHttpChunk(ChannelBuffers.wrappedBuffer(("[{\"id\":1,\"name\":\"" +
                               SOURCE1_NAME + "\"}]").getBytes(Charset.defaultCharset())));
      NettyTestUtils.sendServerResponses(relay, clientAddr, sourcesResp, body);

    //make sure the client processes the response correctly
View Full Code Here

      log.debug("send back the /register response");
      RegisterResponseEntry entry = new RegisterResponseEntry(1L, (short)1, SOURCE1_SCHEMA_STR);
      String responseStr = NettyTestUtils.generateRegisterResponse(entry);
      HttpResponse registerResp = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
                                                         HttpResponseStatus.OK);
      HttpChunk body = new DefaultHttpChunk(
                                  ChannelBuffers.wrappedBuffer(responseStr.getBytes(Charset.defaultCharset())));
      NettyTestUtils.sendServerResponses(relay, clientAddr, registerResp, body);

      log.debug("make sure the client processes the response /register correctly");
      TestUtil.assertWithBackoff(new ConditionCheck()
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.codec.http.HttpChunk

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.