Examples of ChunkedBodyWritableByteChannel


Examples of com.linkedin.databus2.core.container.netty.ChunkedBodyWritableByteChannel

  {
    //HttpRequest request = (HttpRequest) e.getMessage();
    HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
    response.setHeader(CONTENT_TYPE, "text/plain; charset=UTF-8");

    ChunkedBodyWritableByteChannel writeChannel = new ChunkedBodyWritableByteChannel(e.getChannel(),
                                                                                     response);
    for (String key: _headers.keySet())
    {
      writeChannel.setMetadata(key, _headers.get(key));
    }

    for (byte[] chunk: _responseChunks)
    {
      writeChannel.write(ByteBuffer.wrap(chunk));
    }

    writeChannel.setResponseCode(_responseCode);

    for (String key: _footers.keySet())
    {
      writeChannel.setMetadata(key, _footers.get(key));
    }

    writeChannel.close();
  }
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.