Class EndUserFilter

java.lang.Object
com.perfino.filter.EndUserFilter
All Implemented Interfaces:
javax.servlet.Filter

public class EndUserFilter extends Object implements javax.servlet.Filter
Servlet filter for end user experience monitoring.

To enable end user experience monitoring, you have to add this servlet filter to your web.xml file. The servlet filter checks if the response consists of HTML, has a valid <head> tag and is being generated as part of a business transaction. In that case it injects a script that will report back monitoring data from the browser after the page has been loaded. The script will make a request to a URL starting with /__perfino/ below the context path. You have to make sure that requests matching /__perfino/* are passed to this filter.

Special care has to be taken to insert the filter at a stage where the response has not been compressed yet. For example, if you have a filter that compresses the response using gzip, the EndUserFilter has to be added after it, so it can access and modify the uncompressed HTML.

It is not recommended to use end-user experience monitoring for cached pages. If cached pages are served through this filter, the sampling percentage for end user experience monitoring that is defined in the perfino UI should be either 0% or 100%.

To add the filter to your web.xml file, add the filter definition:

 
 <filter>
   <filter-name>euem</filter-name>
   <filter-class>com.perfino.filter.EndUserFilter</filter-class>
 </filter>
 

Then add appropriate filter mappings for the URLs that you would like to monitor. To monitor HTML pages in all URLs, add:

 
 <filter-mapping>
    <filter-name>euem</filter-name>
    <url-pattern>/*</url-pattern>
 </filter-mapping>
 

If you only monitor selected URLs, add the following additional filter mapping as the first mapping:

 
 <filter-mapping>
    <filter-name>euem</filter-name>
    <url-pattern>/__perfino/*</url-pattern>
 </filter-mapping>
 
  • Constructor Details

    • EndUserFilter

      public EndUserFilter()
  • Method Details

    • init

      public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
      Specified by:
      init in interface javax.servlet.Filter
      Throws:
      javax.servlet.ServletException
    • doFilter

      public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
      Specified by:
      doFilter in interface javax.servlet.Filter
      Throws:
      IOException
      javax.servlet.ServletException
    • destroy

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