CXF interceptor that compresses outgoing messages using gzip and sets the
HTTP Content-Encoding header appropriately. An instance of this class should
be added as an out interceptor on clients that need to talk to a service that
accepts gzip-encoded requests or on a service that wants to be able to return
compressed responses. In server mode, the interceptor only compresses
responses if the client indicated (via an Accept-Encoding header on the
request) that it can understand them. To handle gzip-encoded input messages,
see 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).

GZIP_ENCODING_KEY

Key under which we store the name which should be used for the
content-encoding of the outgoing message. Typically "gzip" but may be
"x-gzip" if we are processing a response message and this is the name
given by the client in Accept-Encoding.

gzipPermitted

Checks whether we can, cannot or must use gzip compression on this output
message. Gzip is always permitted if the message is a client request. If
the message is a server response we check the Accept-Encoding header of
the corresponding request message - with no Accept-Encoding we assume
that gzip is not permitted. For the full gory details, see section
14.3 of RFC 2616 (HTTP 1.1).

Parameters:

message - the outgoing message.

Returns:

whether to attempt gzip compression for this message.

Throws:

Fault - if the Accept-Encoding header does not allow any encoding
that we can support (identity, gzip or x-gzip).