Class ServerOutputBuffer

    • Constructor Detail

      • ServerOutputBuffer

        public ServerOutputBuffer()
    • Method Detail

      • sendfile

        public void sendfile​(java.io.File file,
                             long offset,
                             long length,
                             CompletionHandler<WriteResult> handler)
        Description copied from class: OutputBuffer

        Will use FileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel) to send file to the remote endpoint. Note that all headers necessary for the file transfer must be set prior to invoking this method as this will case the HTTP header to be flushed to the client prior to sending the file content. This should also be the last call to write any content to the remote endpoint.

        It's required that the response be suspended when using this functionality. It will be assumed that if the response wasn't suspended when this method is called, that it's desired that this method manages the suspend/resume cycle.

        Overrides:
        sendfile in class OutputBuffer
        Parameters:
        file - the File to transfer.
        offset - the starting offset within the File
        length - the total number of bytes to transfer
        handler - CompletionHandler that will be notified of the transfer progress/completion or failure.
      • recycle

        public void recycle()
        Description copied from class: OutputBuffer
        Recycle the output buffer. This should be called when closing the connection.
        Overrides:
        recycle in class OutputBuffer
      • getThreadPool

        protected java.util.concurrent.Executor getThreadPool()
        Overrides:
        getThreadPool in class OutputBuffer
        Returns:
        Executor, which will be used for notifying user registered WriteHandler.