Package org.eclipse.jetty.server.handler
Class FileBufferedResponseHandler.FileBufferedInterceptor
- java.lang.Object
-
- org.eclipse.jetty.server.handler.FileBufferedResponseHandler.FileBufferedInterceptor
-
- All Implemented Interfaces:
BufferedResponseHandler.BufferedInterceptor
,HttpOutput.Interceptor
- Enclosing class:
- FileBufferedResponseHandler
class FileBufferedResponseHandler.FileBufferedInterceptor extends java.lang.Object implements BufferedResponseHandler.BufferedInterceptor
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Boolean
_aggregating
private HttpChannel
_channel
private java.io.OutputStream
_fileOutputStream
private java.nio.file.Path
_filePath
private HttpOutput.Interceptor
_next
private static int
MAX_MAPPED_BUFFER_SIZE
-
Constructor Summary
Constructors Constructor Description FileBufferedInterceptor(HttpChannel httpChannel, HttpOutput.Interceptor interceptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
aggregate(java.nio.ByteBuffer content)
private void
closeFileOutput()
private void
commit(Callback callback)
protected void
dispose()
HttpOutput.Interceptor
getNextInterceptor()
boolean
isOptimizedForDirectBuffers()
void
resetBuffer()
Reset the buffers.void
write(java.nio.ByteBuffer content, boolean last, Callback callback)
Write content.
-
-
-
Field Detail
-
MAX_MAPPED_BUFFER_SIZE
private static final int MAX_MAPPED_BUFFER_SIZE
- See Also:
- Constant Field Values
-
_next
private final HttpOutput.Interceptor _next
-
_channel
private final HttpChannel _channel
-
_aggregating
private java.lang.Boolean _aggregating
-
_filePath
private java.nio.file.Path _filePath
-
_fileOutputStream
private java.io.OutputStream _fileOutputStream
-
-
Constructor Detail
-
FileBufferedInterceptor
public FileBufferedInterceptor(HttpChannel httpChannel, HttpOutput.Interceptor interceptor)
-
-
Method Detail
-
getNextInterceptor
public HttpOutput.Interceptor getNextInterceptor()
- Specified by:
getNextInterceptor
in interfaceHttpOutput.Interceptor
- Returns:
- The next Interceptor in the chain or null if this is the last Interceptor in the chain.
-
isOptimizedForDirectBuffers
public boolean isOptimizedForDirectBuffers()
- Specified by:
isOptimizedForDirectBuffers
in interfaceHttpOutput.Interceptor
- Returns:
- True if the Interceptor is optimized to receive direct
ByteBuffer
s in theHttpOutput.Interceptor.write(ByteBuffer, boolean, Callback)
method. If false is returned, then passing direct buffers may cause inefficiencies.
-
resetBuffer
public void resetBuffer()
Description copied from interface:HttpOutput.Interceptor
Reset the buffers.If the Interceptor contains buffers then reset them.
- Specified by:
resetBuffer
in interfaceHttpOutput.Interceptor
-
closeFileOutput
private void closeFileOutput()
-
dispose
protected void dispose()
-
write
public void write(java.nio.ByteBuffer content, boolean last, Callback callback)
Description copied from interface:HttpOutput.Interceptor
Write content. The response is committed by the first call to write and is closed by a call with last == true. Empty content buffers may be passed to force a commit or close.- Specified by:
write
in interfaceHttpOutput.Interceptor
- Parameters:
content
- The content to be written or an empty buffer.last
- True if this is the last call to writecallback
- The callback to use to indicateCallback.succeeded()
orCallback.failed(Throwable)
.
-
aggregate
private void aggregate(java.nio.ByteBuffer content) throws java.io.IOException
- Throws:
java.io.IOException
-
commit
private void commit(Callback callback)
-
-