org.apache.cactus.server
class AbstractServletContextWrapper

java.lang.Object
  |
  +--org.apache.cactus.server.AbstractServletContextWrapper
All Implemented Interfaces:
ServletContext
Direct Known Subclasses:
ServletContextWrapper
Known Advisors:
LogAspect

public abstract class AbstractServletContextWrapper
extends java.lang.Object
implements ServletContext

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,v 1.3 2002/03/28 22:00:14 vmassol Exp $
Author:
Vincent Massol

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()
           
 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)
           Affected by: LogAspect
 void log(String theMessage)
           Affected by: LogAspect
 void log(Exception theException, String theMessage)
           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
 
Methods inherited from interface javax.servlet.ServletContext
getResourcePaths, getServletContextName
 

Constructor Detail

AbstractServletContextWrapper

public AbstractServletContextWrapper(ServletContext theOriginalContext)
Method Detail

getAttribute

public Object getAttribute(String theName)
Specified by:
getAttribute in interface ServletContext
Affected by:
around() in LogAspect.

getAttributeNames

public Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface ServletContext

getContext

public ServletContext getContext(String theUripath)
Specified by:
getContext in interface ServletContext
Affected by:
around() in LogAspect.

getInitParameter

public String getInitParameter(String theName)
Specified by:
getInitParameter in interface ServletContext
Affected by:
around() in LogAspect.

getInitParameterNames

public Enumeration getInitParameterNames()
Specified by:
getInitParameterNames in interface ServletContext

getLogs

public Vector getLogs()

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface ServletContext

getMimeType

public String getMimeType(String theFilename)
Specified by:
getMimeType in interface ServletContext
Affected by:
around() in LogAspect.

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface ServletContext

getNamedDispatcher

public RequestDispatcher getNamedDispatcher(String theName)
Specified by:
getNamedDispatcher in interface ServletContext
Affected by:
around() in LogAspect.

getRealPath

public String getRealPath(String thePath)
Specified by:
getRealPath in interface ServletContext
Affected by:
around() in LogAspect.

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String thePath)
Specified by:
getRequestDispatcher in interface ServletContext
Affected by:
around() in LogAspect.

getResource

public URL getResource(String thePath)
                throws java.net.MalformedURLException
Specified by:
getResource in interface ServletContext
Affected by:
around() in LogAspect.

getResourceAsStream

public InputStream getResourceAsStream(String thePath)
Specified by:
getResourceAsStream in interface ServletContext
Affected by:
around() in LogAspect.

getServerInfo

public String getServerInfo()
Specified by:
getServerInfo in interface ServletContext

getServlet

public Servlet getServlet(String theName)
                   throws javax.servlet.ServletException
Specified by:
getServlet in interface ServletContext
Affected by:
around() in LogAspect.

getServletNames

public Enumeration getServletNames()
Specified by:
getServletNames in interface ServletContext

getServlets

public Enumeration getServlets()
Specified by:
getServlets in interface ServletContext

log

public void log(String theMessage,
                Throwable theCause)
Specified by:
log in interface ServletContext
Affected by:
around() in LogAspect.

log

public void log(String theMessage)
Specified by:
log in interface ServletContext
Affected by:
around() in LogAspect.

log

public void log(Exception theException,
                String theMessage)
Specified by:
log in interface ServletContext
Affected by:
around() in LogAspect.

removeAttribute

public void removeAttribute(String theName)
Specified by:
removeAttribute in interface ServletContext
Affected by:
around() in LogAspect.

setAttribute

public void setAttribute(String theName,
                         Object theAttribute)
Specified by:
setAttribute in interface ServletContext
Affected by:
around() in LogAspect.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.