|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | POINTCUT | FIELD | CONSTRUCTOR | METHOD | DETAIL: FIELD | POINTCUT | CONSTRUCTOR | METHOD |
java.lang.Object | +--org.apache.cactus.server.AbstractServletContextWrapper
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.
Constructor Summary | |
AbstractServletContextWrapper(ServletContext theOriginalContext)
|
Method Summary | |
Object |
getAttribute(String theName)
Affected by: LogAspect |
Enumeration |
getAttributeNames()
|
ServletContext |
getContext(String theUripath)
Affected by: LogAspect |
String |
getInitParameter(String theName)
Affected by: LogAspect |
Enumeration |
getInitParameterNames()
|
Vector |
getLogs()
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. |
int |
getMajorVersion()
|
String |
getMimeType(String theFilename)
Affected by: LogAspect |
int |
getMinorVersion()
|
RequestDispatcher |
getNamedDispatcher(String theName)
Affected by: LogAspect |
String |
getRealPath(String thePath)
Affected by: LogAspect |
RequestDispatcher |
getRequestDispatcher(String thePath)
Affected by: LogAspect |
URL |
getResource(String thePath)
Affected by: LogAspect |
InputStream |
getResourceAsStream(String thePath)
Affected by: LogAspect |
String |
getServerInfo()
|
Servlet |
getServlet(String theName)
Affected by: LogAspect |
Enumeration |
getServletNames()
|
Enumeration |
getServlets()
|
void |
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. Affected by: LogAspect |
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. Affected by: LogAspect |
void |
log(Exception theException,
String theMessage)
Deprecated. As of Java Servlet API 2.1, use log(String message, Throwable throwable) instead.
This method was originally defined to write an exception's
stack trace and an explanatory error message to the servlet
log file.
Affected by: LogAspect |
void |
removeAttribute(String theName)
Affected by: LogAspect |
void |
setAttribute(String theName,
Object theAttribute)
Affected by: LogAspect |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractServletContextWrapper(ServletContext theOriginalContext)
theOriginalContext
- the original servlet context object
Method Detail |
public Object getAttribute(String theName)
getAttribute
in interface ServletContext
around() in LogAspect
.public Enumeration getAttributeNames()
getAttributeNames
in interface ServletContext
public ServletContext getContext(String theUripath)
getContext
in interface ServletContext
theUripath
- a String specifying the context path of another web
application in the container
around() in LogAspect
.public String getInitParameter(String theName)
getInitParameter
in interface ServletContext
around() in LogAspect
.public Enumeration getInitParameterNames()
getInitParameterNames
in interface ServletContext
public Vector getLogs()
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.
public int getMajorVersion()
getMajorVersion
in interface ServletContext
public String getMimeType(String theFilename)
getMimeType
in interface ServletContext
around() in LogAspect
.public int getMinorVersion()
getMinorVersion
in interface ServletContext
public RequestDispatcher getNamedDispatcher(String theName)
getNamedDispatcher
in interface ServletContext
theName
- a string specifying the name of a servlet to wrap
around() in LogAspect
.public String getRealPath(String thePath)
getRealPath
in interface ServletContext
around() in LogAspect
.public RequestDispatcher getRequestDispatcher(String thePath)
getRequestDispatcher
in interface ServletContext
thePath
- a string specifying the pathname to the resource
around() in LogAspect
.public URL getResource(String thePath) throws java.net.MalformedURLException
getResource
in interface ServletContext
around() in LogAspect
.public InputStream getResourceAsStream(String thePath)
getResourceAsStream
in interface ServletContext
around() in LogAspect
.public String getServerInfo()
getServerInfo
in interface ServletContext
public Servlet getServlet(String theName) throws javax.servlet.ServletException
getServlet
in interface ServletContext
around() in LogAspect
.public Enumeration getServletNames()
getServletNames
in interface ServletContext
public Enumeration getServlets()
getServlets
in interface ServletContext
public void log(String theMessage, Throwable theCause)
log
in interface ServletContext
theMessage
- a String
that describes the error or
exception
theCause
- the Throwable
error or exception
getLogs()
,
ServletContextaround() in LogAspect
.public void log(String theMessage)
log
in interface ServletContext
theMessage
- a String
that describes the error or
exception
getLogs()
,
ServletContextaround() in LogAspect
.public void log(Exception theException, String theMessage)
log(String message, Throwable throwable)
instead.
This method was originally defined to write an exception's
stack trace and an explanatory error message to the servlet
log file.
log
in interface ServletContext
theException
- the exception to log
theMessage
- a String
that describes the error or
exception
getLogs()
,
ServletContextaround() in LogAspect
.public void removeAttribute(String theName)
removeAttribute
in interface ServletContext
around() in LogAspect
.public void setAttribute(String theName, Object theAttribute)
setAttribute
in interface ServletContext
around() in LogAspect
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTRUCTOR | METHOD | DETAIL: FIELD | CONSTRUCTOR | METHOD |