org.apache.cocoon.servlet
Class BootstrapServlet.ContextWrapper

java.lang.Object
  extended by org.apache.cocoon.servlet.BootstrapServlet.ContextWrapper
All Implemented Interfaces:
ServletContext
Enclosing class:
BootstrapServlet

public static class BootstrapServlet.ContextWrapper
extends Object
implements ServletContext

Wrapper for the ServletContext passed to the actual servlet. It implements all resource-related methods using the provided context root directory. Other calls are delegated to the wrapped context.


Constructor Summary
BootstrapServlet.ContextWrapper(ServletContext context, File contextRoot)
          Builds a wrapper around an existing context, and handle all resource resolution relatively to contextRoot
 
Method Summary
 Object getAttribute(String param)
           
 Enumeration getAttributeNames()
           
 ServletContext getContext(String param)
           
 String getInitParameter(String param)
           
 Enumeration getInitParameterNames()
           
 int getMajorVersion()
           
 String getMimeType(String param)
           
 int getMinorVersion()
           
 RequestDispatcher getNamedDispatcher(String param)
           
 String getRealPath(String path)
          Appends path to the context root.
 RequestDispatcher getRequestDispatcher(String param)
           
 URL getResource(String path)
          Returns the resource URL by appending path to the context root.
 InputStream getResourceAsStream(String path)
          Returns the stream for the result of getResource(), or null if the resource doesn't exist.
 Set getResourcePaths(String param)
           
 String getServerInfo()
           
 Servlet getServlet(String param)
          Deprecated. The method BootstrapServlet.ContextWrapper.getServlet(String) overrides a deprecated method from ServletContext.
 String getServletContextName()
           
 Enumeration getServletNames()
          Deprecated. The method BootstrapServlet.ContextWrapper.getServletNames() overrides a deprecated method from ServletContext.
 Enumeration getServlets()
          Deprecated. The method BootstrapServlet.ContextWrapper.getServlets() overrides a deprecated method from ServletContext.
 void log(Exception ex, String msg)
          Deprecated. use log(String message, Throwable throwable) instead.
 void log(String msg)
           
 void log(String msg, Throwable thr)
           
 void removeAttribute(String name)
           
 void setAttribute(String name, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BootstrapServlet.ContextWrapper

public BootstrapServlet.ContextWrapper(ServletContext context,
                                       File contextRoot)
Builds a wrapper around an existing context, and handle all resource resolution relatively to contextRoot

Method Detail

getContext

public ServletContext getContext(String param)
Specified by:
getContext in interface ServletContext

getMajorVersion

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

getMinorVersion

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

getMimeType

public String getMimeType(String param)
Specified by:
getMimeType in interface ServletContext

getResource

public URL getResource(String path)
                throws MalformedURLException
Returns the resource URL by appending path to the context root. If this doesn't point to an existing file, null is returned.

Specified by:
getResource in interface ServletContext
Throws:
MalformedURLException

getResourceAsStream

public InputStream getResourceAsStream(String path)
Returns the stream for the result of getResource(), or null if the resource doesn't exist.

Specified by:
getResourceAsStream in interface ServletContext

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String param)
Specified by:
getRequestDispatcher in interface ServletContext

getNamedDispatcher

public RequestDispatcher getNamedDispatcher(String param)
Specified by:
getNamedDispatcher in interface ServletContext

getServlet

public Servlet getServlet(String param)
                   throws ServletException
Deprecated. The method BootstrapServlet.ContextWrapper.getServlet(String) overrides a deprecated method from ServletContext.

Specified by:
getServlet in interface ServletContext
Throws:
ServletException
See Also:
ServletContext#getServlet(java.lang.String)

getServlets

public Enumeration getServlets()
Deprecated. The method BootstrapServlet.ContextWrapper.getServlets() overrides a deprecated method from ServletContext.

Specified by:
getServlets in interface ServletContext
See Also:
ServletContext#getServlets()

getServletNames

public Enumeration getServletNames()
Deprecated. The method BootstrapServlet.ContextWrapper.getServletNames() overrides a deprecated method from ServletContext.

Specified by:
getServletNames in interface ServletContext
See Also:
ServletContext#getServletNames()

log

public void log(String msg)
Specified by:
log in interface ServletContext

log

public void log(Exception ex,
                String msg)
Deprecated. use log(String message, Throwable throwable) instead.

Specified by:
log in interface ServletContext

log

public void log(String msg,
                Throwable thr)
Specified by:
log in interface ServletContext

getRealPath

public String getRealPath(String path)
Appends path to the context root.

Specified by:
getRealPath in interface ServletContext

getServerInfo

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

getInitParameter

public String getInitParameter(String param)
Specified by:
getInitParameter in interface ServletContext

getInitParameterNames

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

getAttribute

public Object getAttribute(String param)
Specified by:
getAttribute in interface ServletContext

getAttributeNames

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

setAttribute

public void setAttribute(String name,
                         Object value)
Specified by:
setAttribute in interface ServletContext

removeAttribute

public void removeAttribute(String name)
Specified by:
removeAttribute in interface ServletContext

getResourcePaths

public Set getResourcePaths(String param)

getServletContextName

public String getServletContextName()


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.