Package io.netty.handler.stream

Examples of io.netty.handler.stream.ChunkedStream


        ctx.write(response);

        InputStream contentStream = new ByteArrayInputStream(servletResponse.getContentAsByteArray());

    // Write the content.
        ChannelFuture writeFuture = ctx.write(new ChunkedStream(contentStream));
        writeFuture.addListener(ChannelFutureListener.CLOSE);
    }
View Full Code Here


                // write initial response header
                ctx.write(res);

                // write the content stream
                ctx.pipeline().addBefore(SocketIOChannelInitializer.RESOURCE_HANDLER, "chunkedWriter", new ChunkedWriteHandler());
                ChannelFuture writeFuture = ctx.channel().write(new ChunkedStream(is, fileUrl.getContentLength()));
                   // add operation complete listener so we can close the channel and the input stream
                writeFuture.addListener(ChannelFutureListener.CLOSE);
                return;
            }
        }
View Full Code Here

                // write initial response header
                ctx.write(res);

                // write the content stream
                ctx.pipeline().addBefore(SocketIOChannelInitializer.RESOURCE_HANDLER, "chunkedWriter", new ChunkedWriteHandler());
                ChannelFuture writeFuture = ctx.channel().write(new ChunkedStream(is, fileUrl.getContentLength()));
                   // add operation complete listener so we can close the channel and the input stream
                writeFuture.addListener(ChannelFutureListener.CLOSE);
                return;
            }
        }
View Full Code Here

            }
        } else {
            future.setStreamWasAlreadyConsumed(true);
        }

        channel.write(new ChunkedStream(is), channel.newProgressivePromise()).addListener(
                new ProgressListener(config, future.getAsyncHandler(), future, false, getContentLength()) {
                    public void operationComplete(ChannelProgressiveFuture cf) {
                        closeSilently(is);
                        super.operationComplete(cf);
                    }
View Full Code Here

    public final class WriteStreamHandler extends ChannelInboundHandlerAdapter {

        @Override
        public void channelActive(ChannelHandlerContext ctx) throws Exception {
            super.channelActive(ctx);
            ctx.writeAndFlush(new ChunkedStream(new FileInputStream(file)));
        }
View Full Code Here

                // write initial response header
                ctx.write(res);

                // write the content stream
                ctx.pipeline().addBefore(SocketIOChannelInitializer.RESOURCE_HANDLER, "chunkedWriter", new ChunkedWriteHandler());
                ChannelFuture writeFuture = ctx.channel().write(new ChunkedStream(is, fileUrl.getContentLength()));
                   // add operation complete listener so we can close the channel and the input stream
                writeFuture.addListener(ChannelFutureListener.CLOSE);
                return;
            }
        }
View Full Code Here

        // set Date, Expires, Cache-Control and Last-Modified headers
        setDateAndCacheHeaders(res, lastModified);
        // write initial response header
        ctx.write(res);
        // write the content stream
        ChannelFuture writeFuture = ctx.channel().write(new ChunkedStream(is, fileUrl.getContentLength()));
                 // add operation complete listener so we can close the channel and the input stream
        writeFuture.addListener(new GenericFutureListener<Future<? super Void>>() {

                  @Override
                  public void operationComplete(Future<? super Void> future) throws Exception {
View Full Code Here

        }
    }

    @Test
    public void testChunkedStream() {
        check(new HttpChunkedInput(new ChunkedStream(new ByteArrayInputStream(BYTES))));
    }
View Full Code Here

TOP

Related Classes of io.netty.handler.stream.ChunkedStream

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.