Class ServerOutputBuffer
java.lang.Object
org.glassfish.grizzly.http.io.OutputBuffer
org.glassfish.grizzly.http.server.io.ServerOutputBuffer
-
Nested Class Summary
Nested classes/interfaces inherited from class org.glassfish.grizzly.http.io.OutputBuffer
OutputBuffer.LifeCycleListener -
Field Summary
Fields inherited from class org.glassfish.grizzly.http.io.OutputBuffer
LOGGER, sendfileEnabled -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Executorvoidinitialize(Response response, FilterChainContext ctx) voidrecycle()Recycle the output buffer.voidsendfile(File file, long offset, long length, CompletionHandler<WriteResult> handler) Will useFileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel)to send file to the remote endpoint.Methods inherited from class org.glassfish.grizzly.http.io.OutputBuffer
acknowledge, canWrite, canWrite, canWriteChar, close, endRequest, flush, getBufferedDataSize, getBufferSize, getTrailers, initialize, isAsyncEnabled, isClosed, notifyCanWrite, notifyCanWrite, prepareCharacterEncoder, registerLifeCycleListener, removeLifeCycleListener, reset, sendfile, setAsyncEnabled, setBufferSize, setTrailers, write, write, write, write, write, write, writeBuffer, writeByte, writeByteBuffer, writeChar
-
Constructor Details
-
ServerOutputBuffer
public ServerOutputBuffer()
-
-
Method Details
-
initialize
-
sendfile
Description copied from class:OutputBufferWill 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:
sendfilein classOutputBuffer- Parameters:
file- theFileto transfer.offset- the starting offset within the Filelength- the total number of bytes to transferhandler-CompletionHandlerthat will be notified of the transfer progress/completion or failure.
-
recycle
public void recycle()Description copied from class:OutputBufferRecycle the output buffer. This should be called when closing the connection.- Overrides:
recyclein classOutputBuffer
-
getThreadPool
- Overrides:
getThreadPoolin classOutputBuffer- Returns:
Executor, which will be used for notifying user registeredWriteHandler.
-