Package org.jboss.netty.handler.stream

Examples of org.jboss.netty.handler.stream.ChunkedFile


                        ChannelFuture writeFuture = ch.write(nettyResponse);

                        // Write the content.
                        // If it is not a HEAD
                        if (!nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
                            writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
                        } else {
                            raf.close();
                        }
                        if (!keepAlive) {
                            // Close the connection when the whole content is written out.
View Full Code Here


                            // Write the initial line and the header.
                            ChannelFuture writeFuture = ch.write(nettyResponse);

                            // Write the content.
                            if (!nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
                                writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
                            } else {
                                raf.close();
                            }

                            if (!keepAlive) {
View Full Code Here

                        try {
                            fileLength = raf.length();

                            ChannelFuture writeFuture;
                            if (channel.getPipeline().get(SslHandler.class) != null) {
                                writeFuture = channel.write(new ChunkedFile(raf, 0, fileLength, 8192));
                            } else {
                                final FileRegion region = new OptimizedFileRegion(raf, 0, fileLength);
                                writeFuture = channel.write(region);
                            }
                            writeFuture.addListener(new ProgressListener(false, future.getAsyncHandler(), future));
View Full Code Here

                        ChannelFuture writeFuture = ch.write(nettyResponse);

                        // Write the content.
                        // If it is not a HEAD
                        if (!nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
                            writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
                        } else {
                            raf.close();
                        }
                        if (!keepAlive) {
                            // Close the connection when the whole content is written out.
View Full Code Here

                            // Write the initial line and the header.
                            ChannelFuture writeFuture = ch.write(nettyResponse);

                            // Write the content.
                            if (!nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
                                writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
                            } else {
                                raf.close();
                            }

                            if (!keepAlive) {
View Full Code Here

        if(ByteRangeInput.accepts(nettyRequest)) {
            ByteRangeInput server = new ByteRangeInput(raf, contentType, nettyRequest);
            server.prepareNettyResponse(nettyResponse);
            return server;
        } else {
            return new ChunkedFile(raf);
        }
    }
View Full Code Here

                        ChannelFuture writeFuture = ch.write(nettyResponse);

                        // Write the content.
                        // If it is not a HEAD
                        if (!nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
                            writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
                        } else {
                            raf.close();
                        }
                        if (!keepAlive) {
                            // Close the connection when the whole content is written out.
View Full Code Here

                            // Write the initial line and the header.
                            ChannelFuture writeFuture = ch.write(nettyResponse);

                            // Write the content.
                            if (!nettyRequest.getMethod().equals(HttpMethod.HEAD)) {
                                writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
                            } else {
                                raf.close();
                            }

                            if (!keepAlive) {
View Full Code Here

      this(new File(filename), offset, length);
   }

   public ChunkedFileInputStream(File file, long offset, long length) {
      try {
         this.chunks = new ChunkedFile(new RandomAccessFile(file, "r"), offset, length, CHUNK_SIZE);
      } catch (IOException ex) {
         this.ex = ex;
      }
   }
View Full Code Here

        // Write the content.
        ChannelFuture writeFuture;
        if (ch.getPipeline().get(SslHandler.class) != null) {
            // Cannot use zero-copy with HTTPS.
            writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));
        } else {
            // No encryption - use zero-copy.
            final FileRegion region =
                new DefaultFileRegion(raf.getChannel(), 0, fileLength);
            writeFuture = ch.write(region);
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.stream.ChunkedFile

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.