Top Fields Constructors Methods
org.glassfish.grizzly.http.server.io

public Class ServerOutputBuffer

extends OutputBuffer
Class Inheritance
Imports
java.io.File, .IOException, java.util.concurrent.Executor, java.util.logging.Level, org.glassfish.grizzly.CompletionHandler, .WriteResult, org.glassfish.grizzly.filterchain.FilterChainContext, org.glassfish.grizzly.http.io.OutputBuffer, org.glassfish.grizzly.http.server.Request, .Response, org.glassfish.grizzly.localization.LogMessages

Field Summary

Modifier and TypeField and Description
private volatile Response
Inherited from org.glassfish.grizzly.http.io.OutputBuffer:
LOGGERsendfileEnabled

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
private CompletionHandler<WriteResult<K, L>>
createInternalCompletionHandler(final File file, final boolean suspendedAtStart, final Response serverResponse)

protected Executor
public void
initialize(final Response response, final FilterChainContext ctx)

private boolean
public void
recycle()

Overrides org.glassfish.grizzly.http.io.OutputBuffer.recycle.

Recycle the output buffer.

public void
sendfile(final File file, final long offset, final long length, final CompletionHandler<WriteResult<K, L>> handler)

Overrides org.glassfish.grizzly.http.io.OutputBuffer.sendfile.

Will use java.nio.channels.FileChannel#transferTo(long, long, java.nio.channels.WritableByteChannel) to send file to the remote endpoint.

private CompletionHandler<WriteResult<K, L>>
suspendAndCreateHandler(final CompletionHandler<WriteResult<K, L>> handler, final Response serverResponse)

Inherited from org.glassfish.grizzly.http.io.OutputBuffer:
canWritecanWritecanWriteCharcloseendRequestflushgetBufferedDataSizegetBufferSizegetTrailersinitializeisAsyncEnabledisClosednotifyCanWritenotifyCanWriteprepareCharacterEncoderregisterLifeCycleListenerremoveLifeCycleListenerresetsendfilesetAsyncEnabledsetBufferSizesetTrailerswritewritewritewritewritewritewriteBufferwriteBytewriteByteBufferwriteCharwriteInterimResponse

Field Detail

serverResponseback to summary
private volatile Response serverResponse

Constructor Detail

ServerOutputBufferback to summary
public ServerOutputBuffer()

Method Detail

blockAfterWriteIfNeededback to summary
protected void blockAfterWriteIfNeeded() throws IOException

Overrides org.glassfish.grizzly.http.io.OutputBuffer.blockAfterWriteIfNeeded.

Annotations
@Override
createInternalCompletionHandlerback to summary
private CompletionHandler<WriteResult<K, L>> createInternalCompletionHandler(final File file, final boolean suspendedAtStart, final Response serverResponse)
getThreadPoolback to summary
protected Executor getThreadPool()

Overrides org.glassfish.grizzly.http.io.OutputBuffer.getThreadPool.

Annotations
@Override
initializeback to summary
public void initialize(final Response response, final FilterChainContext ctx)
initializedback to summary
private boolean initialized()
recycleback to summary
public void recycle()

Overrides org.glassfish.grizzly.http.io.OutputBuffer.recycle.

Doc from org.glassfish.grizzly.http.io.OutputBuffer.recycle.

Recycle the output buffer. This should be called when closing the connection.

Annotations
@Override
sendfileback to summary
public void sendfile(final File file, final long offset, final long length, final CompletionHandler<WriteResult<K, L>> handler)

Overrides org.glassfish.grizzly.http.io.OutputBuffer.sendfile.

Doc from org.glassfish.grizzly.http.io.OutputBuffer.sendfile.

Will use java.nio.channels.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.

Annotations
@Override
suspendAndCreateHandlerback to summary
private CompletionHandler<WriteResult<K, L>> suspendAndCreateHandler(final CompletionHandler<WriteResult<K, L>> handler, final Response serverResponse)