com.aoindustries.website.framework
Class ErrorReportingServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.aoindustries.website.framework.ErrorReportingServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
WebPage

public abstract class ErrorReportingServlet
extends javax.servlet.http.HttpServlet

Any error occuring during servlet execution is reported to System.err. Also keeps track of hit stastistics for doGet, doPost, and getLastModified methods.

Author:
AO Industries, Inc.
See Also:
Serialized Form

Field Summary
static int BUFFER_SIZE
          The response buffer is set to this size.
 
Constructor Summary
protected ErrorReportingServlet(LoggerAccessor loggerAccessor)
           
 
Method Summary
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Any error that occurs during a doGet is caught and reported here.
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Any error that occurs during a doPost is caught and reported here.
static long getGetCount()
          Gets the number of GET requests that have been placed.
protected  long getLastModified(javax.servlet.http.HttpServletRequest req)
          Any error that occurs during a getLastModified call is caught here.
static long getLastModifiedCount()
          Gets the number of calls to getLastModified.
 java.util.logging.Logger getLogger()
          Gets the logger for this servlet.
protected  java.util.logging.Logger getLogger(java.lang.Class clazz)
          Gets the logger for the provided class.
protected  java.util.logging.Logger getLogger(java.lang.String name)
          Gets the provided named logger.
protected  LoggerAccessor getLoggerAccessor()
          Gets the loggerAccess for this page.
static long getPostCount()
          Gets the number of POST requests that have been made.
static long getUptime()
          Gets the time the servlet environment was loaded.
 void log(java.lang.String message)
          Deprecated. Please call logger directly for accurate class and method
 void log(java.lang.String message, java.lang.Throwable err)
          Deprecated. Please call logger directly for accurate class and method
protected  void reportingDoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  void reportingDoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
           
protected  long reportingGetLastModified(javax.servlet.http.HttpServletRequest req)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
The response buffer is set to this size.

See Also:
Constant Field Values
Constructor Detail

ErrorReportingServlet

protected ErrorReportingServlet(LoggerAccessor loggerAccessor)
Method Detail

getUptime

public static long getUptime()
Gets the time the servlet environment was loaded.


getLoggerAccessor

protected LoggerAccessor getLoggerAccessor()
Gets the loggerAccess for this page.


getLogger

public java.util.logging.Logger getLogger()
Gets the logger for this servlet.


getLogger

protected java.util.logging.Logger getLogger(java.lang.Class clazz)
Gets the logger for the provided class.


getLogger

protected java.util.logging.Logger getLogger(java.lang.String name)
Gets the provided named logger.


doGet

protected final void doGet(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Any error that occurs during a doGet is caught and reported here.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

protected final void doPost(javax.servlet.http.HttpServletRequest req,
                            javax.servlet.http.HttpServletResponse resp)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Any error that occurs during a doPost is caught and reported here.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

getGetCount

public static long getGetCount()
Gets the number of GET requests that have been placed.


getLastModified

protected final long getLastModified(javax.servlet.http.HttpServletRequest req)
Any error that occurs during a getLastModified call is caught here.

Overrides:
getLastModified in class javax.servlet.http.HttpServlet

getLastModifiedCount

public static long getLastModifiedCount()
Gets the number of calls to getLastModified.


getPostCount

public static long getPostCount()
Gets the number of POST requests that have been made.


reportingDoGet

protected void reportingDoGet(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              java.sql.SQLException,
                              java.io.IOException
Throws:
javax.servlet.ServletException
java.sql.SQLException
java.io.IOException
See Also:
HttpServlet.doGet(HttpServletRequest,HttpServletResponse)

reportingDoPost

protected void reportingDoPost(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse resp)
                        throws javax.servlet.ServletException,
                               java.sql.SQLException,
                               java.io.IOException
Throws:
javax.servlet.ServletException
java.sql.SQLException
java.io.IOException
See Also:
HttpServlet.doPost(HttpServletRequest,HttpServletResponse)

reportingGetLastModified

protected long reportingGetLastModified(javax.servlet.http.HttpServletRequest req)
                                 throws java.io.IOException,
                                        java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException
See Also:
HttpServlet.getLastModified(HttpServletRequest)

log

@Deprecated
public final void log(java.lang.String message)
Deprecated. Please call logger directly for accurate class and method

Overrides:
log in class javax.servlet.GenericServlet

log

@Deprecated
public final void log(java.lang.String message,
                                 java.lang.Throwable err)
Deprecated. Please call logger directly for accurate class and method

Overrides:
log in class javax.servlet.GenericServlet