Examples of ChunkedFile


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

        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

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

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

                            // 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

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

      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

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

        // 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

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

      // Write the initial line and the header.
      ch.write(response);

      // Write the content.
      ChannelFuture writeFuture = ch.write(new ChunkedFile(raf, 0, fileLength, 8192));

      // Decide whether to close the connection or not.
      boolean close = HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION)) || request.getProtocolVersion()
                                                                                                                           .equals(HttpVersion.HTTP_1_0) &&
                      !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION));
View Full Code Here

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

      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

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

        // 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
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.