public class ServerOutputBuffer extends OutputBuffer
OutputBuffer.LifeCycleListener
LOGGER, sendfileEnabled
Constructor and Description |
---|
ServerOutputBuffer() |
Modifier and Type | Method and Description |
---|---|
protected Executor |
getThreadPool() |
void |
initialize(Response response,
FilterChainContext ctx) |
void |
recycle()
Recycle the output buffer.
|
void |
sendfile(File file,
long offset,
long length,
CompletionHandler<WriteResult> handler)
Will use
FileChannel.transferTo(long, long, java.nio.channels.WritableByteChannel)
to send file to the remote endpoint. |
acknowledge, canWrite, canWrite, canWriteChar, close, endRequest, flush, getBufferedDataSize, getBufferSize, initialize, isAsyncEnabled, isClosed, notifyCanWrite, notifyCanWrite, prepareCharacterEncoder, registerLifeCycleListener, removeLifeCycleListener, reset, sendfile, setAsyncEnabled, setBufferSize, write, write, write, write, write, write, writeBuffer, writeByte, writeByteBuffer, writeChar
public void initialize(Response response, FilterChainContext ctx)
public void sendfile(File file, long offset, long length, CompletionHandler<WriteResult> handler)
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.
sendfile
in class OutputBuffer
file
- the File
to transfer.offset
- the starting offset within the Filelength
- the total number of bytes to transferhandler
- CompletionHandler
that will be notified
of the transfer progress/completion or failure.public void recycle()
OutputBuffer
recycle
in class OutputBuffer
protected Executor getThreadPool()
getThreadPool
in class OutputBuffer
Executor
, which will be used for notifying user
registered WriteHandler
.Copyright © 2015 Oracle Corporation. All rights reserved.