Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.util
Class JiveCompressionFilter

java.lang.Object
  extended by com.jivesoftware.base.util.JiveCompressionFilter
All Implemented Interfaces:
JivePropertyListener, javax.servlet.Filter

public class JiveCompressionFilter
extends java.lang.Object
implements javax.servlet.Filter, JivePropertyListener

This filter can, based on HTTP headers compress data written to the response stream. When supported by the client browser, this can potentially greatly reduce the number of bytes written across the network and improve both perceived and actual response times.

This filter has a variety of configuration options available that can be set via jive properties.

Property namedefault valueDescription
jive.compressionFilter.enabledenabledEnable/disable the compression filter
jive.compressionFilter.contentTypestext/html,text/css,text/javascript,application/x-javascript A comma separated list of lowercase content types that this filter will compress. If not provided this filter will only filter content that has a text/* content type.
jive.compressionFilter.excludeUserAgentPatternsN/ASet to a regular expression of any user-agent string that should not be served compressed content. This filter is hardcoded to not serve compressed content to IE < 7 as any version of IE earlier then 7 has known issues with gzip compression
jive.compressionFilter.compressionThreshold1024The smallest response that will be compressed in bytes

Supported compression algorithms

This filter supports the following compression algorithms when compressing data to the response, as specified in the "Accept-Encoding" HTTP request header:

Note that if this filter decides that it should try to compress the response, it will close the response whether or not it ends up compressing the response.


Field Summary
static java.lang.String COMPRESSED_KEY
          A request attribute is set under this key with a non-null value if this filter has applied compression to the response.
static java.lang.String CONTENT_TYPES_PROP
           
static java.lang.String ENABLED_PROP
           
static java.lang.String EXCLUDE_UA_PROP
           
static java.lang.String STATS_ENABLED_PROP
           
static int THRESHOLD_DEFAULT
           
static java.lang.String THRESHOLD_PROP
           
 
Constructor Summary
JiveCompressionFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
           
static JiveCompressionFilterStats getStats()
           
 void init(javax.servlet.FilterConfig config)
           
 void jivePropertyAdded(JivePropertyEvent event)
          Fired when a jive property is added
 void jivePropertyModified(JivePropertyEvent event)
          Fired when a jive property is modified
 void jivePropertyRemoved(JivePropertyEvent event)
          Fired when a jive property is removed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLED_PROP

public static final java.lang.String ENABLED_PROP
See Also:
Constant Field Values

STATS_ENABLED_PROP

public static final java.lang.String STATS_ENABLED_PROP
See Also:
Constant Field Values

CONTENT_TYPES_PROP

public static final java.lang.String CONTENT_TYPES_PROP
See Also:
Constant Field Values

EXCLUDE_UA_PROP

public static final java.lang.String EXCLUDE_UA_PROP
See Also:
Constant Field Values

THRESHOLD_PROP

public static final java.lang.String THRESHOLD_PROP
See Also:
Constant Field Values

THRESHOLD_DEFAULT

public static final int THRESHOLD_DEFAULT
See Also:
Constant Field Values

COMPRESSED_KEY

public static final java.lang.String COMPRESSED_KEY
A request attribute is set under this key with a non-null value if this filter has applied compression to the response. Upstream filters may check for this flag. Note that if the response has been compressed, then it will be closed by the time this filter finishes as well.

See Also:
Constant Field Values
Constructor Detail

JiveCompressionFilter

public JiveCompressionFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
Throws:
java.io.IOException
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter

getStats

public static JiveCompressionFilterStats getStats()

jivePropertyAdded

public void jivePropertyAdded(JivePropertyEvent event)
Description copied from interface: JivePropertyListener
Fired when a jive property is added

Specified by:
jivePropertyAdded in interface JivePropertyListener
Parameters:
event - event fired

jivePropertyRemoved

public void jivePropertyRemoved(JivePropertyEvent event)
Description copied from interface: JivePropertyListener
Fired when a jive property is removed

Specified by:
jivePropertyRemoved in interface JivePropertyListener
Parameters:
event - event fired

jivePropertyModified

public void jivePropertyModified(JivePropertyEvent event)
Description copied from interface: JivePropertyListener
Fired when a jive property is modified

Specified by:
jivePropertyModified in interface JivePropertyListener
Parameters:
event - event fired

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.