Enhydra 5.1 API

org.enhydra.servlet.filter
Class StandardLoggingResponse

java.lang.Object
  |
  +--org.enhydra.servlet.filter.ResponseFilter
        |
        +--org.enhydra.servlet.filter.StandardLoggingResponse
All Implemented Interfaces:
javax.servlet.http.HttpServletResponse, org.apache.tomcat.core.ResponseAdapter, javax.servlet.ServletResponse

public class StandardLoggingResponse
extends ResponseFilter

Author:
Andy John
See Also:
org.enhydra.servlet.StandardLoggingFilter, org.enhydra.servlet.StandardLoggingServlet

Field Summary
 
Fields inherited from class org.enhydra.servlet.filter.ResponseFilter
myResponse
 
Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Constructor Summary
StandardLoggingResponse(javax.servlet.http.HttpServletResponse originalResponse)
          Constructor.
 
Method Summary
 java.lang.String getAction()
          This method is to return that action that was taken, if any.
 int getContentLength()
          This method allows servlets of this package, like the StandardLoggingServlet, to get the information that is grabbed as the setContentLength method is being called.
 java.lang.String getContentType()
          This method allows servlets of this package, like the StandardLoggingServlet, to get the information that is grabbed as the setContentType method is being called.
 int getStatus()
          This method allows servlets of this package, like the StandardLoggingServlet, to get the information that is grabbed as the setStatus method is being called.
 void sendError(int sc)
          This call is passed on to the original HttpServletResponse object.
 void sendError(int sc, java.lang.String msg)
          This call is passed on to the original HttpServletResponse object.
 void sendRedirect(java.lang.String location)
          This call is passed on to the original HttpServletResponse object.
 void setContentLength(int len)
          This call is passed on to the original HttpServletResponse object.
 void setContentType(java.lang.String type)
          This call is passed on to the original HttpServletResponse object.
 void setStatus(int sc)
          This call is passed on to the original HttpServletResponse object.
 void setStatus(int sc, java.lang.String sm)
          This call is passed on to the original HttpServletResponse object.
 boolean wasContentLengthSet()
          Check to see if the contentLength was set
 
Methods inherited from class org.enhydra.servlet.filter.ResponseFilter
addCookie, addDateHeader, addHeader, addIntHeader, addMimeHeaders, containsHeader, doWrite, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, endHeaders, endResponse, flushBuffer, getBufferSize, getCharacterEncoding, getLocale, getOutputStream, getServletOutputStream, getWriter, isCommitted, recycle, reset, setBufferSize, setDateHeader, setHeader, setIntHeader, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardLoggingResponse

public StandardLoggingResponse(javax.servlet.http.HttpServletResponse originalResponse)
Constructor. You must pass in the original response, an id number, the log channel to log to, and the loc level to use. This class passes all calls through unmodified. It makes note of certain calls, storing the parameters. When the method logData() is called, it writes a line to the log channel, describing the

Parameters:
originalResponse - The real HttpServletResponse to route the calls to.
See Also:
ServletResponse, HttpServletResponse
Method Detail

setContentType

public void setContentType(java.lang.String type)
This call is passed on to the original HttpServletResponse object. The type is stored, and will be logged when logData() is called.

Specified by:
setContentType in interface javax.servlet.ServletResponse
Overrides:
setContentType in class ResponseFilter
See Also:
ServletResponse

getContentType

public java.lang.String getContentType()
This method allows servlets of this package, like the StandardLoggingServlet, to get the information that is grabbed as the setContentType method is being called.

Returns:
the contentType of the response

setStatus

public void setStatus(int sc,
                      java.lang.String sm)
This call is passed on to the original HttpServletResponse object. The status is stored, and will be logged when logData() is called.

Specified by:
setStatus in interface javax.servlet.http.HttpServletResponse
Overrides:
setStatus in class ResponseFilter
See Also:
HttpServletResponse

setStatus

public void setStatus(int sc)
This call is passed on to the original HttpServletResponse object. The status is stored, and will be logged when logData() is called.

Specified by:
setStatus in interface javax.servlet.http.HttpServletResponse
Overrides:
setStatus in class ResponseFilter
See Also:
HttpServletResponse

getStatus

public int getStatus()
This method allows servlets of this package, like the StandardLoggingServlet, to get the information that is grabbed as the setStatus method is being called.

Returns:
the status code of the response

setContentLength

public void setContentLength(int len)
This call is passed on to the original HttpServletResponse object. The status is stored, and will be logged when logData() is called.

Specified by:
setContentLength in interface javax.servlet.ServletResponse
Overrides:
setContentLength in class ResponseFilter
See Also:
javax.servlet.HttpServletResponse

getContentLength

public int getContentLength()
This method allows servlets of this package, like the StandardLoggingServlet, to get the information that is grabbed as the setContentLength method is being called.

Returns:
the contentLength of the response

wasContentLengthSet

public boolean wasContentLengthSet()
Check to see if the contentLength was set

Returns:
the boolean value marking if the contentLength was set

getAction

public java.lang.String getAction()
This method is to return that action that was taken, if any. There will only be an action if sendError or sendRedirect was called

Returns:
the action that was taken if sendError was called and NULL if if sendError or sendRedirect was never called.

sendError

public void sendError(int sc,
                      java.lang.String msg)
               throws java.io.IOException
This call is passed on to the original HttpServletResponse object. The error is stored, and will be logged when logData() is called.

Specified by:
sendError in interface javax.servlet.http.HttpServletResponse
Overrides:
sendError in class ResponseFilter
Throws:
java.io.IOException - See HttpServletResponse documentation
See Also:
HttpServletResponse

sendError

public void sendError(int sc)
               throws java.io.IOException
This call is passed on to the original HttpServletResponse object. The error is stored, and will be logged when logData() is called.

Specified by:
sendError in interface javax.servlet.http.HttpServletResponse
Overrides:
sendError in class ResponseFilter
Throws:
java.io.IOException - See HttpServletResponse documentation
See Also:
HttpServletResponse

sendRedirect

public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
This call is passed on to the original HttpServletResponse object. The redirect location is stored, and will be logged when logData() is called.

Specified by:
sendRedirect in interface javax.servlet.http.HttpServletResponse
Overrides:
sendRedirect in class ResponseFilter
Throws:
java.io.IOException - See HttpServletResponse documentation
See Also:
HttpServletResponse

Enhydra 5.1 API