public class GZIPOutInterceptor extends AbstractPhaseInterceptor<Message>
GZIPInInterceptor
. This interceptor supports a compression
threshold
(default 1kB) - messages smaller than this threshold will
not be compressed. To force compression of all messages, set the threshold to
0. This class was originally based on one of the CXF samples
(configuration_interceptor).Modifier and Type | Class and Description |
---|---|
static class |
GZIPOutInterceptor.UseGzip
Enum giving the possible values for whether we should gzip a particular
message.
|
Modifier and Type | Field and Description |
---|---|
static Pattern |
ENCODINGS
regular expression which can split encodings
|
static String |
GZIP_ENCODING_KEY
Key under which we store the name which should be used for the
content-encoding of the outgoing message.
|
static String |
ORIGINAL_OUTPUT_STREAM_KEY
Key under which we store the original output stream on the message, for
use by the ending interceptor.
|
static String |
SOAP_JMS_CONTENTENCODING |
static String |
USE_GZIP_KEY
Key under which we store an indication of whether compression is
permitted or required, for use by the ending interceptor.
|
static Pattern |
ZERO_Q
regular expression that matches any encoding with a
q-value of 0 (or 0.0, 0.00, etc.).
|
Constructor and Description |
---|
GZIPOutInterceptor() |
GZIPOutInterceptor(int threshold) |
Modifier and Type | Method and Description |
---|---|
int |
getThreshold() |
static GZIPOutInterceptor.UseGzip |
gzipPermitted(Message message,
boolean force)
Checks whether we can, cannot or must use gzip compression on this output
message.
|
void |
handleMessage(Message message)
Intercepts a message.
|
void |
setForce(boolean force) |
void |
setThreshold(int threshold) |
addAfter, addAfter, addBefore, addBefore, getAdditionalInterceptors, getAfter, getBefore, getId, getPhase, handleFault, isGET, isRequestor, setAfter, setBefore
public static final Pattern ZERO_Q
public static final Pattern ENCODINGS
public static final String ORIGINAL_OUTPUT_STREAM_KEY
public static final String USE_GZIP_KEY
public static final String GZIP_ENCODING_KEY
public static final String SOAP_JMS_CONTENTENCODING
public GZIPOutInterceptor()
public GZIPOutInterceptor(int threshold)
public void setThreshold(int threshold)
public int getThreshold()
public void handleMessage(Message message) throws Fault
Interceptor
Fault
public static GZIPOutInterceptor.UseGzip gzipPermitted(Message message, boolean force) throws Fault
message
- the outgoing message.Fault
- if the Accept-Encoding header does not allow any encoding
that we can support (identity, gzip or x-gzip).public void setForce(boolean force)
Apache CXF