abstractpublic class AbstractServletContextWrapper implements ServletContext(Code)
Abstract wrapper around ServletContext. This class provides
a common implementation of the wrapper for the different servlet API. In
addition to implementing the ServletContext interface it
provides additional features helpful for writing unit tests. More
specifically the getRequestDispatcher() method is overrided
to return an request dispatcher wrapper. In addition logs generated by
calls to the log() methods can be retrieved and asserted by
calling the getLogs() method.
version: $Id: AbstractServletContextWrapper.java 239054 2004-10-24 01:30:23Z felipeal $
log(String theMessage, Throwable theCause) Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer.
public void
log(String theMessage) Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer.
public void
log(Exception theException, String theMessage) Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer.
Parameters: theUripath - a String specifying the context path of another webapplication in the container our servlet context wrapper See Also:ServletContext.getContext(String)
Parameters: theName - the name of the parameter's value to return the value of the parameter, looking for it first in the list ofparameters set using the setInitParameter() methodand then in those set in web.xml.
Returns all the text logs that have been generated using the
log() methods so that it is possible to easily assert the
content of the logs. This method does not return the exceptions or
throwable sent for logging; it only returns the messages.
the logs as a vector of strings (each string contains themessage that was sent for logging).
Parameters: theName - a string specifying the name of a servlet to wrap our request dispatcher wrapper or null if the servlet cannotbe found. See Also:ServletContext.getNamedDispatcher(String)
Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer. Note that the throwable is not saved.
Parameters: theMessage - a String that describes the error orexception Parameters: theCause - the Throwable error or exception See Also:AbstractServletContextWrapper.getLogs() See Also:ServletContext.log(StringThrowable)
Intercept the log call and add the message to an internal vector of
log messages that can then later be retrieved and asserted by the
test case writer. Note that the throwable is not saved.
Parameters: theMessage - a String that describes the error orexception See Also:AbstractServletContextWrapper.getLogs() See Also:ServletContext.log(String)
Sets a parameter as if it were set in the web.xml file
(using the <context-param> element).
Parameters: theName - the parameter's name Parameters: theValue - the parameter's value