com.jamonapi.http
Class HttpMonFactory

java.lang.Object
  extended by com.jamonapi.http.HttpMonFactory
Direct Known Subclasses:
JettyHttpMonFactory

public class HttpMonFactory
extends java.lang.Object

Base class that monitors a httpServletRequest, and HttpServletResponse by returning an HttpMonRequest object per page request. Although this class can be used directly it will more often be used transparently by classes such as JAMonTomcat55Valve, JAMonServletFilter and JAMonJettyHandler. To get a list of many possible (though not all) HttpServletRequest and HttpServletResponse labels pass 'demo' to the valve, handler or servlet filter. You can also see these same possibiliteis by calling HttpMonFactory.getDemoLabels(). Note jetty and tomcat handler and valve respectively are based on objects that inherit from HttpServletRequest and HttpServletResponse respectively and all methods that these subclasses implement are available too.
representative values returned from response methods
response.getBufferSize()=8192
response.getCharacterEncoding()=utf-8
response.getContentCount()=985
response.getContentType()=text/html;charset=utf-8
response.getLocale()=en_US

representative values returned from request methods
request.getAuthType()=null
request.getCharacterEncoding()=null
request.getContentLength()=-1
request.getCharacterEncoding()=null
request.getContentType()=null
request.getContextPath()=/jamon
request.getLocalAddr()=127.0.0.1
request.getLocale()=en_US
request.getLocalName()=localhost
request.getLocalPort()=8080
request.getMethod()=GET
request.getPathInfo()=null
request.getPathTranslated()=null
request.getProtocol()=HTTP/1.1
request.getQueryString()=name=steve%20souza&id=9898
request.getRemoteAddr()=127.0.0.1
request.getRemoteHost()=127.0.0.1
request.getRemotePort()=1454
request.getRemoteUser()=null
request.getRequestedSessionId()=670BFE2B4A7C7C77D9825EFA753D2058
request.getRequestURI()=/jamon/ZZZZ
request.getRequestURL()=http://localhost:8080/jamon/ZZZZ
request.getScheme()=http
request.getServerName()=localhost
request.getServerPort()=8080
request.getServletPath()=/ZZZZ
request.getUserPrincipal()=null
request.isRequestedSessionIdFromCookie()=true
request.isRequestedSessionIdFromURL()=false
request.isRequestedSessionIdValid()=false
request.isSecure()=false

Author:
steve souza

Constructor Summary
HttpMonFactory(java.lang.String labelPrefix)
          Create an HttpMonFactory by passing in text that occurs at the beginning of all jamon labels.
 
Method Summary
 void addSummaryLabel(java.lang.String jamonSummaryLabel)
          Pass a String that has an HttpServletRequest/HttpServletResponse method such as response.getStatus() and then this class will monitor that method call.
static java.lang.String getDemoLabels()
           
 boolean getEnabled()
          Determin if http monitoring is enabled
 boolean getIgnoreHttpParams()
          Determine if http params are ignored when creating a jamon label for request.getRequestURI(), and request.getRequestURL().
 java.lang.String getLabelPrefix()
           
 HttpMon getMon(java.lang.Object request, java.lang.Object response)
           
 int getSize()
          Get the max number of possible HttpMonitors.
 java.lang.String getSummaryLabels()
          Get the passed in summaryLabels.
static void main(java.lang.String[] argas)
          Simple test code
 void setEnabled(boolean enable)
          Enable/disable http monitoring
 void setIgnoreHttpParams(boolean ignoreHttpParams)
          Set if http params are ignored when creating a jamon label for request.getRequestURI(), and request.getRequestURL().
 void setSize(int size)
          Set the max number of possible HttpMonitors.
 void setSummaryLabels(java.lang.String jamonSummaryLabels)
          Pass a series of things (HttpServletRequest/HttpServletResponse methods) to monitor.
 void setSummaryLabels(java.lang.String summaryLabel, java.lang.String defaultString)
           
 HttpMon start(java.lang.Object request, java.lang.Object response)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpMonFactory

public HttpMonFactory(java.lang.String labelPrefix)
Create an HttpMonFactory by passing in text that occurs at the beginning of all jamon labels. ex com.jamonapi.http.JAMonTomcatValve

Method Detail

setSummaryLabels

public void setSummaryLabels(java.lang.String jamonSummaryLabels)
Pass a series of things (HttpServletRequest/HttpServletResponse methods) to monitor. If the word 'default' is passed then the default values will be used. If 'demo' is passed you will see a list of possibilities (This should not be done in production as too much data would be generated). You can add to the default by doing passing "default, request.getStatus().httpStatus". Each time this method is called any previously set items that were being monitored will not longer be monitored. See http://www.jamonapi.com for more examples.


getDemoLabels

public static java.lang.String getDemoLabels()

setSummaryLabels

public void setSummaryLabels(java.lang.String summaryLabel,
                             java.lang.String defaultString)

addSummaryLabel

public void addSummaryLabel(java.lang.String jamonSummaryLabel)
Pass a String that has an HttpServletRequest/HttpServletResponse method such as response.getStatus() and then this class will monitor that method call.


getSummaryLabels

public java.lang.String getSummaryLabels()
Get the passed in summaryLabels.


getIgnoreHttpParams

public boolean getIgnoreHttpParams()
Determine if http params are ignored when creating a jamon label for request.getRequestURI(), and request.getRequestURL(). This is important for jsessionid can make every label passed to jamon nonunique if not enabled. By default this value is true (ignore params).


setIgnoreHttpParams

public void setIgnoreHttpParams(boolean ignoreHttpParams)
Set if http params are ignored when creating a jamon label for request.getRequestURI(), and request.getRequestURL(). This is important for jsessionid can make every label passed to jamon nonunique if not enabled. By default this value is true (ignore params).


setEnabled

public void setEnabled(boolean enable)
Enable/disable http monitoring


getEnabled

public boolean getEnabled()
Determin if http monitoring is enabled


getSize

public int getSize()
Get the max number of possible HttpMonitors. By default this is 5000


setSize

public void setSize(int size)
Set the max number of possible HttpMonitors. By default this is 5000. A value <=0 means there is no limit on the number of jamon records that can be creating due to monitoring.


getLabelPrefix

public java.lang.String getLabelPrefix()

getMon

public HttpMon getMon(java.lang.Object request,
                      java.lang.Object response)

start

public HttpMon start(java.lang.Object request,
                     java.lang.Object response)

main

public static void main(java.lang.String[] argas)
Simple test code