com.planetj.servlet.filter.compression
Class CompressingFilterStats

java.lang.Object
  extended by com.planetj.servlet.filter.compression.CompressingFilterStats
All Implemented Interfaces:
java.io.Serializable

public final class CompressingFilterStats
extends java.lang.Object
implements java.io.Serializable

This class provides runtime statistics on the performance of CompressingFilter. If stats are enabled, then an instance of this object will be available in the servlet context under the key STATS_KEY. It can be retrieved and used like so:

 ServletContext ctx = ...;
 // in a JSP, "ctx" is already available as the "application" variable
 CompressingFilterStats stats = (CompressingFilterStats) ctx.getAttribute(CompressingFilterStats.STATS_KEY);
 double ratio = stats.getAverageCompressionRatio();
 ...
 

Since:
1.1
Author:
Sean Owen
See Also:
Serialized Form

Field Summary
static java.lang.String STATS_KEY
          Key under which a CompressingFilterStats object can be found in the servlet context.
 
Method Summary
 double getAverageCompressionRatio()
          Deprecated. use getResponseAverageCompressionRatio()
 long getCompressedBytes()
          Deprecated. use getResponseCompressedBytes()
 long getInputBytes()
          Deprecated. use getResponseInputBytes()
 int getNumRequestsCompressed()
           
 int getNumResponsesCompressed()
           
 double getRequestAverageCompressionRatio()
           
 long getRequestCompressedBytes()
           
 long getRequestInputBytes()
           
 double getResponseAverageCompressionRatio()
           
 long getResponseCompressedBytes()
           
 long getResponseInputBytes()
           
 int getTotalRequestsNotCompressed()
           
 int getTotalResponsesNotCompressed()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATS_KEY

public static final java.lang.String STATS_KEY
Key under which a CompressingFilterStats object can be found in the servlet context.

See Also:
Constant Field Values
Method Detail

getNumResponsesCompressed

public int getNumResponsesCompressed()
Returns:
the number of responses which CompressingFilter has compressed.

getTotalResponsesNotCompressed

public int getTotalResponsesNotCompressed()
Returns:
the number of responses which CompressingFilter has processed but not compressed for some reason (compression not supported by the browser, for example).

getInputBytes

@Deprecated
public long getInputBytes()
Deprecated. use getResponseInputBytes()


getResponseInputBytes

public long getResponseInputBytes()
Returns:
total number of bytes written to the CompressingFilter in responses.

getCompressedBytes

@Deprecated
public long getCompressedBytes()
Deprecated. use getResponseCompressedBytes()


getResponseCompressedBytes

public long getResponseCompressedBytes()
Returns:
total number of compressed bytes written by the CompressingFilter to the client in responses.

getAverageCompressionRatio

@Deprecated
public double getAverageCompressionRatio()
Deprecated. use getResponseAverageCompressionRatio()


getResponseAverageCompressionRatio

public double getResponseAverageCompressionRatio()
Returns:
average compression ratio (input bytes / compressed bytes) in responses, or 0 if nothing has yet been compressed. Note that this is (typically) greater than 1, not less than 1.

getNumRequestsCompressed

public int getNumRequestsCompressed()
Returns:
the number of requests which CompressingFilter has compressed.
Since:
1.6

getTotalRequestsNotCompressed

public int getTotalRequestsNotCompressed()
Returns:
the number of requests which CompressingFilter has processed but not compressed for some reason (no compression requested, for example).
Since:
1.6

getRequestInputBytes

public long getRequestInputBytes()
Returns:
total number of bytes written to the CompressingFilter in requests.
Since:
1.6

getRequestCompressedBytes

public long getRequestCompressedBytes()
Returns:
total number of compressed bytes written by the CompressingFilter to the client in requests.
Since:
1.6

getRequestAverageCompressionRatio

public double getRequestAverageCompressionRatio()
Returns:
average compression ratio (input bytes / compressed bytes) in requests, or 0 if nothing has yet been compressed. Note that this is (typically) greater than 1, not less than 1.
Since:
1.6

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a summary of the stats in String form