to.etc.dbpool
Class StatisticsRequestListener

java.lang.Object
  extended by to.etc.dbpool.StatisticsRequestListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.ServletRequestListener

public class StatisticsRequestListener
extends java.lang.Object
implements javax.servlet.ServletRequestListener

This listener can be used to collect statistics for the database pool when to.etc.dbpool's pool manager is used. This collects the URL's used as input and collates database usage statistics per page.

Author:
Frits Jalvingh Created on Feb 22, 2007

Constructor Summary
StatisticsRequestListener()
           
 
Method Summary
static void createSessionStats(javax.servlet.http.HttpServletRequest r)
          Create a HttpSession, and add a Session Statistics block there.
static void destroySessionStats(javax.servlet.http.HttpServletRequest r)
          Destroy any known session stats structure.
static GlobalPerformanceStore getGlobalStore()
          Returns the current global performance store maintained by this listener.
static SessionStatistics getSessionStatistics(javax.servlet.http.HttpServletRequest r)
           
 void requestDestroyed(javax.servlet.ServletRequestEvent ev)
           
 void requestInitialized(javax.servlet.ServletRequestEvent ev)
           
static void setForceEncoding(java.lang.String forceEncoding)
          Advanced horror mode: Internet Exploder, who else, does not send the charset it encoded the parameters with in it's content type for input received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsRequestListener

public StatisticsRequestListener()
Method Detail

setForceEncoding

public static void setForceEncoding(java.lang.String forceEncoding)
Advanced horror mode: Internet Exploder, who else, does not send the charset it encoded the parameters with in it's content type for input received. Because of this, when content is sent to the server from IE that is encoded in UTF-8, the server does not know that and will decode the parameters as the default encoding (iso-8859-1 probably). This will cause parameter values to be wrong. And because these are decoded only once by Tomcat and then stored- using the getParameter() call here will cause encoding problems. Parameters are decoded as iso-8859-1 and a later call to use UTF-8 encoding is silently ignored, because otherwise the problem would be clear. The workaround here is to force input decoding to a specified encoding (usually UTF-8) always when the charset header is missing.

Parameters:
forceEncoding -

requestDestroyed

public void requestDestroyed(javax.servlet.ServletRequestEvent ev)
Specified by:
requestDestroyed in interface javax.servlet.ServletRequestListener

requestInitialized

public void requestInitialized(javax.servlet.ServletRequestEvent ev)
Specified by:
requestInitialized in interface javax.servlet.ServletRequestListener
See Also:
ServletRequestListener.requestInitialized(javax.servlet.ServletRequestEvent)

destroySessionStats

public static void destroySessionStats(javax.servlet.http.HttpServletRequest r)
Destroy any known session stats structure.

Parameters:
r -

createSessionStats

public static void createSessionStats(javax.servlet.http.HttpServletRequest r)
Create a HttpSession, and add a Session Statistics block there. This will start session statistics collection. If the block already exists nothing happens.

Parameters:
r -

getSessionStatistics

@Nullable
public static SessionStatistics getSessionStatistics(javax.servlet.http.HttpServletRequest r)

getGlobalStore

public static GlobalPerformanceStore getGlobalStore()
Returns the current global performance store maintained by this listener. Returns null if not collecting statistics.

Returns: