public static interface HttpOutput.Interceptor
The Interceptor can be used to implement translations (eg Gzip) or additional buffering that acts on all output. Interceptors are created in a chain, so that multiple concerns may intercept.
The HttpChannel
is an HttpOutput.Interceptor
and is always the
last link in any Interceptor chain.
Responses are committed by the first call to
write(ByteBuffer, boolean, Callback)
and closed by a call to write(ByteBuffer, boolean, Callback)
with the last boolean set true. If no content is available to commit
or close, then a null buffer is passed.
Modifier and Type | Method and Description |
---|---|
HttpOutput.Interceptor |
getNextInterceptor() |
boolean |
isOptimizedForDirectBuffers() |
default void |
resetBuffer()
Reset the buffers.
|
void |
write(ByteBuffer content,
boolean last,
Callback callback)
Write content.
|
void write(ByteBuffer content, boolean last, Callback callback)
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 indicate Callback.succeeded()
or Callback.failed(Throwable)
.HttpOutput.Interceptor getNextInterceptor()
boolean isOptimizedForDirectBuffers()
ByteBuffer
s in the write(ByteBuffer, boolean, Callback)
method. If false is returned, then passing direct buffers may cause
inefficiencies.default void resetBuffer() throws IllegalStateException
If the Interceptor contains buffers then reset them.
IllegalStateException
- Thrown if the response has been
committed and buffers and/or headers cannot be reset.Copyright © 2010 - 2020 Adobe. All Rights Reserved