Package org.glassfish.grizzly

Examples of org.glassfish.grizzly.FileTransfer


       
        // flush response
        ctx.write(response);

        // send-file
        final FileTransfer f = new FileTransfer(
                cacheEntry.getFile(isServeCompressed),
                0, cacheEntry.getFileSize(isServeCompressed));
        ctx.write(f, new EmptyCompletionHandler<WriteResult>() {
            @Override
            public void failed(Throwable throwable) {
View Full Code Here


        // clear the internal buffers; sendfile content is exclusive
        reset();

        // additional precondition validation performed by FileTransfer
        // constructor
        final FileTransfer f = new FileTransfer(file, offset, length);

        // lock further sendfile requests out
        fileTransferRequested = true;

        outputHeader.setContentLengthLong(f.remaining());
        if (outputHeader.getContentType() == null) {
            outputHeader.setContentType(MimeType.getByFilename(file.getName()));
        }
        // set Content-Encoding to identity to prevent compression
        outputHeader.setHeader(Header.ContentEncoding, HeaderValue.IDENTITY);
View Full Code Here

        // clear the internal buffers; sendfile content is exclusive
        reset();

        // additional precondition validation performed by FileTransfer
        // constructor
        final FileTransfer f = new FileTransfer(file, offset, length);

        // lock further sendfile requests out
        fileTransferRequested = true;

        outputHeader.setContentLengthLong(f.remaining());
        if (outputHeader.getContentType() == null) {
            outputHeader.setContentType(MimeType.getByFilename(file.getName()));
        }
        // set Content-Encoding to identity to prevent compression
        outputHeader.setHeader(Header.ContentEncoding, HeaderValue.IDENTITY);
View Full Code Here

       
        // flush response
        ctx.write(response);

        // send-file
        final FileTransfer f = new FileTransfer(
                cacheEntry.getFile(isServeCompressed),
                0, cacheEntry.getFileSize(isServeCompressed));
        ctx.write(f, new EmptyCompletionHandler<WriteResult>() {
            // keep strong ref to FileCacheEntry to save it from GC,
            // because GC may remove the actual file (the compressed one)
View Full Code Here

                }
            }
        } else {
            // write the headers
            ctx.write(requestPacket, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
            ctx.write(new FileTransfer(f), new EmptyCompletionHandler<WriteResult>() {

                @Override
                public void updated(WriteResult result) {
                    notifyHandlerIfNeeded(context, requestPacket, result);
                }
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.FileTransfer

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.