## org.mortbay.jetty.handler
Class StatisticsHandler

    java.lang.Object
      org.mortbay.component.AbstractLifeCycle
          org.mortbay.jetty.handler.AbstractHandler
              org.mortbay.jetty.handler.AbstractHandlerContainer
                  org.mortbay.jetty.handler.HandlerWrapper
                      org.mortbay.jetty.handler.StatisticsHandler

All Implemented Interfaces:
  LifeCycle, Handler, HandlerContainer

    public class StatisticsHandler

extends HandlerWrapper

Field Summary

Fields inherited from class org.mortbay.jetty.handler.AbstractHandler
`_string`

Fields inherited from interface org.mortbay.jetty.Handler
`ALL, DEFAULT, ERROR, FORWARD, INCLUDE, REQUEST`

Constructor Summary
`StatisticsHandler()`

Method Summary
`protected void` `doStart()`
`protected void` `doStop()`
`int` `getRequests()`
`int` `getRequestsActive()`
`int` `getRequestsActiveMax()`
`int` `getRequestsActiveMin()`
`long` `getRequestsDurationAve()`
`long` `getRequestsDurationMax()`
`long` `getRequestsDurationMin()`
`long` `getRequestsDurationTotal()`
`int` `getResponses1xx()`
`int` `getResponses2xx()`
`int` `getResponses3xx()`
`int` `getResponses4xx()`
`int` `getResponses5xx()`
`long` `getStatsOnMs()`
`void` `handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch)` Handle a request.
`void` `statsReset()`

Methods inherited from class org.mortbay.jetty.handler.HandlerWrapper
`addHandler, expandChildren, getHandler, setHandler, setServer`

Methods inherited from class org.mortbay.jetty.handler.AbstractHandlerContainer
`expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass`

Methods inherited from class org.mortbay.jetty.handler.AbstractHandler
`destroy, getServer, toString`

Methods inherited from class org.mortbay.component.AbstractLifeCycle
`isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.mortbay.component.LifeCycle
`isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop`

Constructor Detail

### StatisticsHandler

    public StatisticsHandler()

Method Detail

### statsReset

    public void statsReset()

### handle

    public void handle(String target,
                       HttpServletRequest request,
                       HttpServletResponse response,
                       int dispatch)
                throws IOException,
                       ServletException

  Description copied from interface: `Handler`
  Handle a request.

  Specified by:
    `handle` in interface `Handler`
  Overrides:
    `handle` in class `HandlerWrapper`
  Parameters:
    `target` - The target of the request - either a URI or a name.
    `request` - The request either as the `Request` object or a wrapper of that request. The `HttpConnection.getCurrentConnection()` method can be used access the Request object if required.
    `response` - The response as the `Response` object or a wrapper of that request. The `HttpConnection.getCurrentConnection()` method can be used access the Response object if required.
    `dispatch` - The dispatch mode: `Handler.REQUEST`, `Handler.FORWARD`, `Handler.INCLUDE`, `Handler.ERROR`
  Throws:
    `IOException`
    `ServletException`

### doStart

    protected void doStart()
                    throws Exception

  Overrides:
    `doStart` in class `HandlerWrapper`
  Throws:
    `Exception`

### doStop

    protected void doStop()
                   throws Exception

  Overrides:
    `doStop` in class `HandlerWrapper`
  Throws:
    `Exception`

### getRequests

    public int getRequests()

  Returns:
    Get the number of requests handled by this context since last call of statsReset(). If setStatsOn(false) then this is undefined.

### getRequestsActive

    public int getRequestsActive()

  Returns:
    Number of requests currently active. Undefined if setStatsOn(false).

### getRequestsActiveMax

    public int getRequestsActiveMax()

  Returns:
    Maximum number of active requests since statsReset() called. Undefined if setStatsOn(false).

### getResponses1xx

    public int getResponses1xx()

  Returns:
    Get the number of responses with a 2xx status returned by this context since last call of statsReset(). Undefined if if setStatsOn(false).

### getResponses2xx

    public int getResponses2xx()

  Returns:
    Get the number of responses with a 100 status returned by this context since last call of statsReset(). Undefined if if setStatsOn(false).

### getResponses3xx

    public int getResponses3xx()

  Returns:
    Get the number of responses with a 3xx status returned by this context since last call of statsReset(). Undefined if if setStatsOn(false).

### getResponses4xx

    public int getResponses4xx()

  Returns:
    Get the number of responses with a 4xx status returned by this context since last call of statsReset(). Undefined if if setStatsOn(false).

### getResponses5xx

    public int getResponses5xx()

  Returns:
    Get the number of responses with a 5xx status returned by this context since last call of statsReset(). Undefined if if setStatsOn(false).

### getStatsOnMs

    public long getStatsOnMs()

  Returns:
    Timestamp stats were started at.

### getRequestsActiveMin

    public int getRequestsActiveMin()

  Returns:
    Returns the requestsActiveMin.

### getRequestsDurationMin

    public long getRequestsDurationMin()

  Returns:
    Returns the requestsDurationMin.

### getRequestsDurationTotal

    public long getRequestsDurationTotal()

  Returns:
    Returns the requestsDurationTotal.

### getRequestsDurationAve

    public long getRequestsDurationAve()

  Returns:
    Average duration of request handling in milliseconds since statsReset() called. Undefined if setStatsOn(false).

### getRequestsDurationMax

    public long getRequestsDurationMax()

  Returns:
    Get maximum duration in milliseconds of request handling since statsReset() called. Undefined if setStatsOn(false).

Copyright © 2007 Mort Bay Consulting. All Rights Reserved.