Timing filter ver. 1.3

This is a Java servlet filter (as per Servlet API 2.3). This filter lets you record the duration for the each request into system log as well as collect it for the future processing. Filter uses the log file provided by your container. And this filter lets you simply add response time stats analysis for your web application.

How to use it:

a) download timingflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml.
 


<filter>
  <filter-name>TimingFilter</filter-name>
  <filter-class>com.cj.timing.TimingFilter</filter-class>
</filter>

c) describe a mapping for this filter in web.xml
 


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

in this case filter will be on for the each request and collect stats for the requests. You can see collected stats via TimingServlet. Describe this servlet and mapping in your web.xml file:
 


<servlet>
  <servlet-name>TimingServlet</servlet-name>
  <servlet-class>com.cj.timing.TimingServlet</servlet-class>
</servlet>

and mapping:
 


<servlet-mapping>
  <servlet-name>TimingServlet</servlet-name>
  <url-pattern>/servlet/TimingServlet</url-pattern>
</servlet-mapping>

now when you run it: http://your_host/servlet/TimingServlet you will see the accumulated stat. You can provide an uri (part of it) response time you are interested in as a parameter for this servlet. E.g.: http://your_host/servlet/TimingServlet?/mydir will print statistics for all the HTTP requests to mydir directory.

   For downloading:

    Timing filter:  timingflt.jar
 

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: