public class GzipHttpOutputInterceptor extends java.lang.Object implements HttpOutput.Interceptor
Modifier and Type | Class and Description |
---|---|
private class |
GzipHttpOutputInterceptor.GzipBufferCB |
private static class |
GzipHttpOutputInterceptor.GZState |
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
_buffer |
private int |
_bufferSize |
private HttpChannel |
_channel |
private java.util.zip.CRC32 |
_crc |
private java.util.zip.Deflater |
_deflater |
private GzipFactory |
_factory |
private HttpOutput.Interceptor |
_interceptor |
private java.util.concurrent.atomic.AtomicReference<GzipHttpOutputInterceptor.GZState> |
_state |
private boolean |
_syncFlush |
private HttpField |
_vary |
private static byte[] |
GZIP_HEADER |
static Logger |
LOG |
static HttpField |
VARY_ACCEPT_ENCODING |
static HttpField |
VARY_ACCEPT_ENCODING_USER_AGENT |
Constructor and Description |
---|
GzipHttpOutputInterceptor(GzipFactory factory,
HttpChannel channel,
HttpOutput.Interceptor next,
boolean syncFlush) |
GzipHttpOutputInterceptor(GzipFactory factory,
HttpField vary,
HttpChannel channel,
HttpOutput.Interceptor next,
boolean syncFlush) |
GzipHttpOutputInterceptor(GzipFactory factory,
HttpField vary,
int bufferSize,
HttpChannel channel,
HttpOutput.Interceptor next,
boolean syncFlush) |
Modifier and Type | Method and Description |
---|---|
private void |
addTrailer() |
protected void |
commit(java.nio.ByteBuffer content,
boolean complete,
Callback callback) |
private java.lang.String |
etagGzip(java.lang.String etag) |
HttpOutput.Interceptor |
getNextInterceptor() |
private void |
gzip(java.nio.ByteBuffer content,
boolean complete,
Callback callback) |
boolean |
isOptimizedForDirectBuffers() |
boolean |
mightCompress() |
void |
noCompression() |
void |
noCompressionIfPossible() |
void |
write(java.nio.ByteBuffer content,
boolean complete,
Callback callback)
Write content.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resetBuffer
public static Logger LOG
private static final byte[] GZIP_HEADER
public static final HttpField VARY_ACCEPT_ENCODING_USER_AGENT
public static final HttpField VARY_ACCEPT_ENCODING
private final java.util.concurrent.atomic.AtomicReference<GzipHttpOutputInterceptor.GZState> _state
private final java.util.zip.CRC32 _crc
private final GzipFactory _factory
private final HttpOutput.Interceptor _interceptor
private final HttpChannel _channel
private final HttpField _vary
private final int _bufferSize
private final boolean _syncFlush
private java.util.zip.Deflater _deflater
private java.nio.ByteBuffer _buffer
public GzipHttpOutputInterceptor(GzipFactory factory, HttpChannel channel, HttpOutput.Interceptor next, boolean syncFlush)
public GzipHttpOutputInterceptor(GzipFactory factory, HttpField vary, HttpChannel channel, HttpOutput.Interceptor next, boolean syncFlush)
public GzipHttpOutputInterceptor(GzipFactory factory, HttpField vary, int bufferSize, HttpChannel channel, HttpOutput.Interceptor next, boolean syncFlush)
public HttpOutput.Interceptor getNextInterceptor()
getNextInterceptor
in interface HttpOutput.Interceptor
public boolean isOptimizedForDirectBuffers()
isOptimizedForDirectBuffers
in interface HttpOutput.Interceptor
ByteBuffer
s in the HttpOutput.Interceptor.write(ByteBuffer, boolean, Callback)
method. If false is returned, then passing direct buffers may cause
inefficiencies.public void write(java.nio.ByteBuffer content, boolean complete, Callback callback)
HttpOutput.Interceptor
write
in interface HttpOutput.Interceptor
content
- The content to be written or an empty buffer.complete
- True if this is the last call to writecallback
- The callback to use to indicate Callback.succeeded()
or Callback.failed(Throwable)
.private void addTrailer()
private void gzip(java.nio.ByteBuffer content, boolean complete, Callback callback)
protected void commit(java.nio.ByteBuffer content, boolean complete, Callback callback)
private java.lang.String etagGzip(java.lang.String etag)
public void noCompression()
public void noCompressionIfPossible()
public boolean mightCompress()