Examples of DynamicChannelBuffer


Examples of org.jboss.netty.buffer.DynamicChannelBuffer

            // make this garbage free (eg. reuse output buffers). To do that,
            // we probably need to patch netty. It brings this buffer all the
            // way down to it's deepest dungeons, and then eventually copies it into
            // kernel space. We need to know when that has happened and reuse the buffer.
            // Perhaps introduce a ring buffer to rotate used buffers back up here?
            final DynamicChannelBuffer content = new DynamicChannelBuffer(
                    1000);
            Serializer serializer = serializationFactory.getSerializer(content);
            serializationStrategy.serialize(data, serializer);
            serializer.flush();
           
            response.setHeader(HttpHeaders.Names.CONTENT_TYPE, serializer.getContentType().toString());
            response.setHeader(HttpHeaders.Names.CONTENT_LENGTH, content.writerIndex());
            response.setContent(content);
        }

        ChannelFuture future = channel.write(response);
View Full Code Here

Examples of org.jboss.netty.buffer.DynamicChannelBuffer

        //
        // set body
        BodyGenerator bodyGenerator = request.getBodyGenerator();
        if (bodyGenerator != null) {
            DynamicChannelBuffer content = new DynamicChannelBuffer(64 * 1024);
            ChannelBufferOutputStream out = new ChannelBufferOutputStream(content);
            bodyGenerator.write(out);

            nettyRequest.setHeader(Names.CONTENT_LENGTH, content.readableBytes());
            nettyRequest.setContent(content);
        }
        return nettyRequest;
    }
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.