vmassol 01/08/29 06:23:36
Modified: cactus/src/framework/servlet23/org/apache/commons/cactus/server
ServletContextWrapper.java
Log:
factored Servlet APIs common behaviours into AbstractServletContextWrapper
Revision Changes Path
1.4 +11 -138
jakarta-commons/cactus/src/framework/servlet23/org/apache/commons/cactus/server/ServletContextWrapper.java
Index: ServletContextWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/cactus/src/framework/servlet23/org/apache/commons/cactus/server/ServletContextWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletContextWrapper.java 2001/08/24 16:23:17 1.3
+++ ServletContextWrapper.java 2001/08/29 13:23:36 1.4
@@ -63,80 +63,33 @@
import javax.servlet.http.*;
/**
- * Wrapper around <code>ServletContext</code> which overrides the
- * <code>getRequestDispatcher()</code> method to return our own wrapper around
- * <code>RequestDispatcher</code>.
+ * Wrapper around Servlet 2.3 <code>ServletContext</code>. This wrapper
+ * provides additional behaviour (see
+ * <code>AbstractServletContextWrapper</code>).
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
*
- * @version $Id: ServletContextWrapper.java,v 1.3 2001/08/24 16:23:17 vmassol Exp $
+ * @version $Id: ServletContextWrapper.java,v 1.4 2001/08/29 13:23:36 vmassol Exp $
* @see RequestDispatcherWrapper
*/
-public class ServletContextWrapper implements ServletContext
+public class ServletContextWrapper extends AbstractServletContextWrapper
{
/**
- * The original servlet context object
- */
- private ServletContext originalContext;
-
- /**
* @param theOriginalContext the original servlet context object
*/
public ServletContextWrapper(ServletContext theOriginalContext)
- {
- this.originalContext = theOriginalContext;
- }
-
- public void setAttribute(String theName, Object theAttribute)
- {
- this.originalContext.setAttribute(theName, theAttribute);
- }
-
- public void removeAttribute(String theName)
- {
- this.originalContext.removeAttribute(theName);
- }
-
- public void log(String theMessage, Throwable theCause)
- {
- this.originalContext.log(theMessage, theCause);
- }
-
- public void log(String theMessage)
{
- this.originalContext.log(theMessage);
+ super(theOriginalContext);
}
- public void log(Exception theException, String theMessage)
- {
- this.originalContext.log(theException, theMessage);
- }
-
- public Enumeration getServlets()
- {
- return this.originalContext.getServlets();
- }
-
- public Enumeration getServletNames()
- {
- return this.originalContext.getServletNames();
- }
-
public String getServletContextName()
{
return this.originalContext.getServletContextName();
}
-
- public Servlet getServlet(String theName) throws ServletException
- {
- return this.originalContext.getServlet(theName);
- }
-
- public String getServerInfo()
- {
- return this.originalContext.getServerInfo();
- }
+ /**
+ * @see getResourcePaths(String)
+ */
public Set getResourcePaths()
{
Set returnSet;
@@ -166,8 +119,8 @@
/**
* Added to support the changes of the Jakarta Servlet API 2.3 of the
* 17/03/2001 (in anticipation of the upcoming draft of Servlet 2.3). Kept
- * the method without parameters for servlet engines that do have upgraded
- * yet to the new signature.
+ * the method without parameters for servlet engines that do not have
+ * upgraded yet to the new signature.
*/
public Set getResourcePaths(String thePath)
{
@@ -194,86 +147,6 @@
}
return returnSet;
- }
-
- public InputStream getResourceAsStream(String thePath)
- {
- return this.originalContext.getResourceAsStream(thePath);
- }
-
- public URL getResource(String thePath) throws MalformedURLException
- {
- return this.originalContext.getResource(thePath);
- }
-
- /**
- * @return our request dispatcher wrapper
- */
- public RequestDispatcher getRequestDispatcher(String thePath)
- {
- RequestDispatcher dispatcher = new RequestDispatcherWrapper(
- this.originalContext.getRequestDispatcher(thePath));
- return dispatcher;
- }
-
- public String getRealPath(String thePath)
- {
- return this.originalContext.getRealPath(thePath);
- }
-
- /**
- * @return our request dispatcher wrapper
- */
- public RequestDispatcher getNamedDispatcher(String theName)
- {
- RequestDispatcher dispatcher = new RequestDispatcherWrapper(
- this.originalContext.getNamedDispatcher(theName));
- return dispatcher;
- }
-
- public int getMinorVersion()
- {
- return this.originalContext.getMinorVersion();
- }
-
- public String getMimeType(String theFilename)
- {
- return this.originalContext.getMimeType(theFilename);
- }
-
- public int getMajorVersion()
- {
- return this.originalContext.getMajorVersion();
- }
-
- public Enumeration getInitParameterNames()
- {
- return this.originalContext.getInitParameterNames();
- }
-
- public String getInitParameter(String theName)
- {
- return this.originalContext.getInitParameter(theName);
- }
-
- /**
- * @return our servlet context wrapper
- */
- public ServletContext getContext(String theUripath)
- {
- ServletContext context = new ServletContextWrapper(
- this.originalContext.getContext(theUripath));
- return context;
- }
-
- public Enumeration getAttributeNames()
- {
- return this.originalContext.getAttributeNames();
- }
-
- public Object getAttribute(String theName)
- {
- return this.originalContext.getAttribute(theName);
}
}