net.sf.infrared.agent.setup
Class MonitorHTTPServletFilter

java.lang.Object
  extended bynet.sf.infrared.agent.setup.MonitorHTTPServletFilter
All Implemented Interfaces:
Filter

public class MonitorHTTPServletFilter
extends Object
implements Filter

The HTTP Servlet Filter which enables/disables monitoring for a given HTTP request. This enabling/disabling works in conjunction with other switches available in MonitorConfig class. It works by calling the MonitorConfig.enableMonitoringForCurrentThread(boolean) method

This HTTP servlet filter can optionally take an ServletMonitorFilter implementation. as an initialization parameter. This ServletMonitorFilter implementation can specify if monitoring should be set ON/OFF for a request. The typical use of this is enable monitoring on for a given user-login.

 
   
     InfraREDFilter
     net.sf.infrared.agent.setup.MonitorHTTPServletFilter
     
       monitorFilter
       your.ServletMonitorFilter.Implementation
     
   
 
 

.* If no monitorFilter parameter is specified, all requests will be unmonitored.


Constructor Summary
MonitorHTTPServletFilter()
           
 
Method Summary
static void applyFilter(boolean isFilterToBeApplied)
          Sets whether filter needs to be applied or not.
 void destroy()
          Discards this HTTP Servlet Filter instance
 void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
          Performs the action of the HTTP Servlet Filter.
static String getFilterName()
           
 void init(FilterConfig filterConfig)
          Initializes this HTTP Servlet filter instance.
static boolean isFilterToBeApplied()
          Checks if a filter needs to be applied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitorHTTPServletFilter

public MonitorHTTPServletFilter()
Method Detail

init

public void init(FilterConfig filterConfig)
          throws ServletException
Initializes this HTTP Servlet filter instance.

Specified by:
init in interface Filter
Parameters:
filterConfig -
Throws:
ServletException

destroy

public void destroy()
Discards this HTTP Servlet Filter instance

Specified by:
destroy in interface Filter

doFilter

public void doFilter(ServletRequest servletRequest,
                     ServletResponse servletResponse,
                     FilterChain filterChain)
              throws IOException,
                     ServletException
Performs the action of the HTTP Servlet Filter. Set the monitoringEnabled for current thread to TRUE/FALSE values based on the moniforFilter implementation specified and passes on the control thru the filterChain.

Specified by:
doFilter in interface Filter
Parameters:
servletRequest -
servletResponse -
filterChain -
Throws:
IOException
ServletException

isFilterToBeApplied

public static boolean isFilterToBeApplied()
Checks if a filter needs to be applied.

Returns:
true, if filtering is performed on all requests; else false

applyFilter

public static void applyFilter(boolean isFilterToBeApplied)
Sets whether filter needs to be applied or not.

Parameters:
isFilterToBeApplied -

getFilterName

public static String getFilterName()