org.apache.tapestry5.internal.services
Class ResponseCompressionAnalyzerImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.services.ResponseCompressionAnalyzerImpl
All Implemented Interfaces:
ResponseCompressionAnalyzer

public class ResponseCompressionAnalyzerImpl
extends Object
implements ResponseCompressionAnalyzer


Constructor Summary
ResponseCompressionAnalyzerImpl(HttpServletRequest request, CompressionAnalyzer analyzer, Collection<String> configuration, boolean gzipCompressionEnabled)
           
 
Method Summary
 boolean isCompressable(String contentType)
          Checks to see if the indicated content type is compressable.
 boolean isGZipSupported()
          Checks the Accept-Encoding request header for a "gzip" token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseCompressionAnalyzerImpl

public ResponseCompressionAnalyzerImpl(HttpServletRequest request,
                                       CompressionAnalyzer analyzer,
                                       @Deprecated
                                       Collection<String> configuration,
                                       @Symbol(value="tapestry.gzip-compression-enabled")
                                       boolean gzipCompressionEnabled)
Method Detail

isGZipSupported

public boolean isGZipSupported()
Description copied from interface: ResponseCompressionAnalyzer
Checks the Accept-Encoding request header for a "gzip" token. Ensures that the protocol is not "HTTP/1.0", which does not correctly support GZip encoding (in older Internet Explorer browsers).

Specified by:
isGZipSupported in interface ResponseCompressionAnalyzer
Returns:
true if gzip is supported by client

isCompressable

public boolean isCompressable(String contentType)
Description copied from interface: ResponseCompressionAnalyzer
Checks to see if the indicated content type is compressable. Many formats are already compressed; pushing them through a GZip filter consumes cycles and makes them larger.

Contribute content type strings to the service's configuration to mark them as not compressable.

Specified by:
isCompressable in interface ResponseCompressionAnalyzer
Parameters:
contentType - the mime type of the content, such as "text/html" or "image/jpeg".
Returns:
true if compression is worthwhile


Copyright © 2003-2012 The Apache Software Foundation.