Class ServerOutputBuffer

java.lang.Object
org.glassfish.grizzly.http.io.OutputBuffer
org.glassfish.grizzly.http.server.io.ServerOutputBuffer

public class ServerOutputBuffer extends OutputBuffer
  • Constructor Details

    • ServerOutputBuffer

      public ServerOutputBuffer()
  • Method Details

    • initialize

      public void initialize(Response response, FilterChainContext ctx)
    • sendfile

      public void sendfile(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 Executor getThreadPool()
      Overrides:
      getThreadPool in class OutputBuffer
      Returns:
      Executor, which will be used for notifying user registered WriteHandler.