com.mtgi.analytics.servlet
Class BehaviorTrackingFilter

java.lang.Object
  extended by com.mtgi.analytics.servlet.BehaviorTrackingFilter
All Implemented Interfaces:
javax.servlet.Filter

public class BehaviorTrackingFilter
extends Object
implements javax.servlet.Filter

A servlet filter which logs all activity to an instance of BehaviorTrackingManager in the application's Spring context. All request parameters and any specific response status code is included in the event data.

If there is only one BehaviorTrackingManager in the Spring context, that instance is used automatically. If there is more than one, which manager the filter should use is configured using the init parameter com.mtgi.analytics.manager.

By default all events generated by this filter will have a type of http-request. An alternate type value can be specified using the filter parameter com.mtgi.analytics.servlet.event.


Field Summary
static String ATT_FILTER_REGISTERED
           
static String PARAM_EVENT_TYPE
          filter parameter specifying the eventType value to use when logging behavior tracking events.
static String PARAM_MANAGER_NAME
          filter parameter specifying the bean name of the BehaviorTrackingManager instance to use in the application spring context.
static String PARAM_PARAMETERS_INCLUDE
          filter parameter specifying a list of parameters to include in logging; defaults to all if unspecified
 
Constructor Summary
BehaviorTrackingFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
           
 void init(javax.servlet.FilterConfig config)
           
static boolean isFiltered(javax.servlet.ServletContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_MANAGER_NAME

public static final String PARAM_MANAGER_NAME
filter parameter specifying the bean name of the BehaviorTrackingManager instance to use in the application spring context.

See Also:
Constant Field Values

PARAM_EVENT_TYPE

public static final String PARAM_EVENT_TYPE
filter parameter specifying the eventType value to use when logging behavior tracking events.

See Also:
Constant Field Values

PARAM_PARAMETERS_INCLUDE

public static final String PARAM_PARAMETERS_INCLUDE
filter parameter specifying a list of parameters to include in logging; defaults to all if unspecified

See Also:
Constant Field Values

ATT_FILTER_REGISTERED

public static final String ATT_FILTER_REGISTERED
Constructor Detail

BehaviorTrackingFilter

public BehaviorTrackingFilter()
Method Detail

isFiltered

public static boolean isFiltered(javax.servlet.ServletContext context)

destroy

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

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 IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
Throws:
IOException
javax.servlet.ServletException