org.apache.tapestry.util.io
Class GzipUtil

java.lang.Object
  extended by org.apache.tapestry.util.io.GzipUtil

public final class GzipUtil
extends Object

Encapsulates logic related to various gzip compression schemes and their rules as they apply to different browsers.


Method Summary
static boolean isGzipCapable(WebRequest request)
          Determines if gzip compression is appropriate/possible based on the User Agent and other limiting factors.
static boolean shouldCompressContentType(String contentType)
          Based on the given type of content, determines if compression is appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isGzipCapable

public static boolean isGzipCapable(WebRequest request)
Determines if gzip compression is appropriate/possible based on the User Agent and other limiting factors. IE versions < 6.1 are known to not work with gzip compression reliably.

Parameters:
request - The current web request to check the headers of.
Returns:
True, if this request can be served in gzip format. False otherwise.

shouldCompressContentType

public static boolean shouldCompressContentType(String contentType)
Based on the given type of content, determines if compression is appropriate. The biggest thing it does is make sure that image content isn't compressed as that kind of content is already compressed fairly well.

Parameters:
contentType - The content type to check. (ie "text/javascript","text/html", etc..)
Returns:
True if compression is appropriate for the content specified, false otherwise.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.