All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.apache.tomcat.core.Context

java.lang.Object
   |
   +----org.apache.tomcat.core.Context

public class Context
extends Object
Context represent a Web Application as specified by Servlet Specs. The implementation is a repository for all the properties defined in web.xml and tomcat specific properties, with all the functionality delegated to interceptors.

Author:
James Duncan Davidson [duncan@eng.sun.com], James Todd [gonzo@eng.sun.com], Jason Hunter [jch@eng.sun.com], Harish Prabandham, costin@dnt.ro, Gal Shachor shachor@il.ibm.com

Constructor Index

 o Context()

Method Index

 o addContentType(String, String)
 o addContextInterceptor(ContextInterceptor)
Deprecated.
 o addEnvEntry(String, String, String, String)
Add Env-entry to this context
 o addErrorPage(String, String)
 o addInitParameter(String, String)
 o addRequestInterceptor(RequestInterceptor)
Deprecated.
 o addSecurityConstraint(String[], String[], String[], String)
 o addServlet(ServletWrapper)
Add a servlet with the given name to the container.
 o addServletMapping(String, String)
Maps a named servlet to a particular path or extension.
 o addTaglib(String, String)
Add a taglib declaration for this context
 o addWelcomeFile(String)
 o expectUserWelcomeFiles()
If any new welcome file is added, remove the old list of welcome files and start a new one.
 o getAttribute(String)
 o getAttributeNames()
 o getAuthMethod()
Authentication method, if any specified
 o getContainer(String)
 o getContainerLocations()
 o getContainers()
 o getContextInterceptors()
Return the context interceptors as an array. Deprecated.
 o getContextManager()
 o getDebug()
 o getDefaultServlet()
 o getDescription()
 o getDocBase()
 o getDocumentBase()
Deprecated.
 o getEngineHeader()
Deprecated.
 o getEnvEntries()
 o getEnvEntryType(String)
 o getEnvEntryValue(String)
 o getErrorPage(int)
 o getErrorPage(String)
 o getFormErrorPage()
 o getFormLoginPage()
 o getInitParameter(String)
 o getInitParameterNames()
 o getMimeMap()
 o getNamedDispatcher(String)
 o getPath()
 o getRealmName()
Realm to be used
 o getReloadable()
Should we reload servlets ?
 o getRequestDispatcher(String)
 o getRequestInterceptors()
Return the context interceptors as an array. Deprecated.
 o getRequestSecurityProvider()
Deprecated.
 o getResource(String)
Implements getResource() - use a sub-request to let interceptors do the job.
 o getServletByName(String)
 o getServletLoader()
 o getServletNames()
 o getSessionManager()
 o getSessionTimeOut()
 o getTaglibLocation(String)
 o getTaglibs()
 o getWARDir()
Deprecated.
 o getWelcomeFiles()
 o getWorkDir()
Deprecated.
 o isDistributable()
 o isInvokerEnabled()
Deprecated.
 o isWARExpanded()
Deprecated.
 o isWARValidated()
Deprecated.
 o isWorkDirPersistent()
Deprecated.
 o log(String)
Internal log method
 o log(String, Throwable)
 o logServlet(String, Throwable)
User-level log method ( called from a servlet)
 o removeAttribute(String)
 o removeContainer(Container)
 o removeServletByName(String)
Remove the servlet with a specific name
 o removeWelcomeFiles()
Deprecated.
 o setAttribute(String, Object)
 o setContextManager(ContextManager)
 o setDebug(int)
 o setDebug(String)
 o setDescription(String)
 o setDistributable(boolean)
 o setDocBase(String)
DocBase points to the web application files.
 o setDocumentBase(URL)
Deprecated.
 o setEngineHeader(String)
Deprecated.
 o setIcon(String)
 o setInitParameter(String, String)
Deprecated.
 o setInvokerEnabled(boolean)
Deprecated.
 o setIsWARExpanded(boolean)
Deprecated.
 o setIsWARValidated(boolean)
Deprecated.
 o setLoginConfig(String, String, String, String)
 o setPath(String)
 o setReloadable(boolean)
 o setReloadable(String)
 o setRequestSecurityProvider(RequestSecurityProvider)
Deprecated.
 o setServletLoader(ServletLoader)
 o setSessionManager(SessionManager)
 o setSessionTimeOut(int)
 o setWARDir(File)
Deprecated.
 o setWorkDir(File)
Deprecated.
 o setWorkDirPath(String)
Set work dir using a String property Deprecated.
 o setWorkDirPersistent(boolean)
Deprecated.
 o toString()

Constructors

 o Context
 public Context()

Methods

 o getContextManager
 public ContextManager getContextManager()
 o setContextManager
 public void setContextManager(ContextManager cm)
 o getPath
 public String getPath()
 o setPath
 public void setPath(String path)
 o setDocBase
 public void setDocBase(String docB)
DocBase points to the web application files. There is no restriction on the syntax and content of DocBase, it's up to the various modules to interpret this and use it. For example, to server from a war file you can use war: protocol, and set up War interceptors. "Basic" tomcat treats it is a file ( either absolute or relative to the CM home ). If docBase is relative assume it is relative to the context manager home.

 o getDocBase
 public String getDocBase()
 o setReloadable
 public void setReloadable(String s)
 o setReloadable
 public void setReloadable(boolean b)
 o getReloadable
 public boolean getReloadable()
Should we reload servlets ?

 o getWelcomeFiles
 public Enumeration getWelcomeFiles()
 o removeWelcomeFiles
 public void removeWelcomeFiles()
Note: removeWelcomeFiles() is deprecated. It is used as a hack to allow web.xml override default welcome files. Tomcat will first load the "default" web.xml and then this file.

 o expectUserWelcomeFiles
 public void expectUserWelcomeFiles()
If any new welcome file is added, remove the old list of welcome files and start a new one. This is used as a hack to allow a default web.xml file to specifiy welcome files. We should use a better mechanism!

 o addWelcomeFile
 public void addWelcomeFile(String s)
 o addTaglib
 public void addTaglib(String uri,
                       String location)
Add a taglib declaration for this context

 o getTaglibLocation
 public String getTaglibLocation(String uri)
 o getTaglibs
 public Enumeration getTaglibs()
 o addEnvEntry
 public void addEnvEntry(String name,
                         String type,
                         String value,
                         String description)
Add Env-entry to this context

 o getEnvEntryType
 public String getEnvEntryType(String name)
 o getEnvEntryValue
 public String getEnvEntryValue(String name)
 o getEnvEntries
 public Enumeration getEnvEntries()
 o getInitParameter
 public String getInitParameter(String name)
 o setInitParameter
 public void setInitParameter(String name,
                              String value)
Note: setInitParameter() is deprecated. use addInitParameter

 o addInitParameter
 public void addInitParameter(String name,
                              String value)
 o getInitParameterNames
 public Enumeration getInitParameterNames()
 o getAttribute
 public Object getAttribute(String name)
 o getAttributeNames
 public Enumeration getAttributeNames()
 o setAttribute
 public void setAttribute(String name,
                          Object object)
 o removeAttribute
 public void removeAttribute(String name)
 o getDescription
 public String getDescription()
 o setDescription
 public void setDescription(String description)
 o setIcon
 public void setIcon(String icon)
 o isDistributable
 public boolean isDistributable()
 o setDistributable
 public void setDistributable(boolean isDistributable)
 o getSessionTimeOut
 public int getSessionTimeOut()
 o setSessionTimeOut
 public void setSessionTimeOut(int sessionTimeOut)
 o getMimeMap
 public FileNameMap getMimeMap()
 o addContentType
 public void addContentType(String ext,
                            String type)
 o getErrorPage
 public String getErrorPage(int errorCode)
 o addErrorPage
 public void addErrorPage(String errorType,
                          String value)
 o getErrorPage
 public String getErrorPage(String errorCode)
 o getAuthMethod
 public String getAuthMethod()
Authentication method, if any specified

 o getRealmName
 public String getRealmName()
Realm to be used

 o getFormLoginPage
 public String getFormLoginPage()
 o getFormErrorPage
 public String getFormErrorPage()
 o setLoginConfig
 public void setLoginConfig(String authMethod,
                            String realmName,
                            String formLoginPage,
                            String formErrorPage)
 o addServletMapping
 public void addServletMapping(String path,
                               String servletName) throws TomcatException
Maps a named servlet to a particular path or extension. If the named servlet is unregistered, it will be added and subsequently mapped. Note that the order of resolution to handle a request is: exact mapped servlet (eg /catalog) prefix mapped servlets (eg /foo/bar/*) extension mapped servlets (eg *jsp) default servlet

 o addSecurityConstraint
 public void addSecurityConstraint(String path[],
                                   String methods[],
                                   String roles[],
                                   String transport) throws TomcatException
 o getContainers
 public Enumeration getContainers()
 o getContainerLocations
 public Enumeration getContainerLocations()
 o getContainer
 public Container getContainer(String path)
 o removeContainer
 public void removeContainer(Container ct)
 o getDefaultServlet
 public ServletWrapper getDefaultServlet()
 o removeServletByName
 public void removeServletByName(String servletName) throws TomcatException
Remove the servlet with a specific name

 o getServletByName
 public ServletWrapper getServletByName(String servletName)
 o addServlet
 public void addServlet(ServletWrapper wrapper) throws TomcatException
Add a servlet with the given name to the container. The servlet will be loaded by the container's class loader and instantiated using the given class name. Called to add a new servlet from web.xml

 o getServletNames
 public Enumeration getServletNames()
 o getSessionManager
 public SessionManager getSessionManager()
 o setSessionManager
 public void setSessionManager(SessionManager manager)
 o setServletLoader
 public void setServletLoader(ServletLoader loader)
 o getServletLoader
 public ServletLoader getServletLoader()
 o setDebug
 public void setDebug(int level)
 o setDebug
 public void setDebug(String level)
 o getDebug
 public int getDebug()
 o log
 public final void log(String msg)
Internal log method

 o log
 public void log(String msg,
                 Throwable t)
 o logServlet
 public void logServlet(String msg,
                        Throwable t)
User-level log method ( called from a servlet)

 o toString
 public String toString()
Overrides:
toString in class Object
 o getRequestDispatcher
 public RequestDispatcher getRequestDispatcher(String path)
 o getNamedDispatcher
 public RequestDispatcher getNamedDispatcher(String name)
 o getResource
 public URL getResource(String rpath) throws MalformedURLException
Implements getResource() - use a sub-request to let interceptors do the job.

 o isInvokerEnabled
 public boolean isInvokerEnabled()
Note: isInvokerEnabled() is deprecated.

 o setInvokerEnabled
 public void setInvokerEnabled(boolean isInvokerEnabled)
Note: setInvokerEnabled() is deprecated.

 o isWorkDirPersistent
 public boolean isWorkDirPersistent()
Note: isWorkDirPersistent() is deprecated.

 o setWorkDirPersistent
 public void setWorkDirPersistent(boolean b)
Note: setWorkDirPersistent() is deprecated.

 o getWorkDir
 public File getWorkDir()
Note: getWorkDir() is deprecated.

 o setWorkDir
 public void setWorkDir(File workDir)
Note: setWorkDir() is deprecated.

 o setWorkDirPath
 public void setWorkDirPath(String workDir)
Note: setWorkDirPath() is deprecated.

Set work dir using a String property

 o getEngineHeader
 public String getEngineHeader()
Note: getEngineHeader() is deprecated.

 o setEngineHeader
 public void setEngineHeader(String s)
Note: setEngineHeader() is deprecated.

 o setRequestSecurityProvider
 public void setRequestSecurityProvider(RequestSecurityProvider rsProvider)
Note: setRequestSecurityProvider() is deprecated.

 o getRequestSecurityProvider
 public RequestSecurityProvider getRequestSecurityProvider()
Note: getRequestSecurityProvider() is deprecated.

 o getWARDir
 public File getWARDir()
Note: getWARDir() is deprecated.

 o setWARDir
 public void setWARDir(File f)
Note: setWARDir() is deprecated.

 o isWARExpanded
 public boolean isWARExpanded()
Note: isWARExpanded() is deprecated.

 o setIsWARExpanded
 public void setIsWARExpanded(boolean isWARExpanded)
Note: setIsWARExpanded() is deprecated.

 o isWARValidated
 public boolean isWARValidated()
Note: isWARValidated() is deprecated.

 o setIsWARValidated
 public void setIsWARValidated(boolean isWARValidated)
Note: setIsWARValidated() is deprecated.

 o addContextInterceptor
 public void addContextInterceptor(ContextInterceptor ci)
Note: addContextInterceptor() is deprecated.

 o getContextInterceptors
 public ContextInterceptor[] getContextInterceptors()
Note: getContextInterceptors() is deprecated.

Return the context interceptors as an array. For performance reasons we use an array instead of returning the vector - the interceptors will not change at runtime and array access is faster and easier than vector access

 o addRequestInterceptor
 public void addRequestInterceptor(RequestInterceptor ci)
Note: addRequestInterceptor() is deprecated.

 o getRequestInterceptors
 public RequestInterceptor[] getRequestInterceptors()
Note: getRequestInterceptors() is deprecated.

Return the context interceptors as an array. For performance reasons we use an array instead of returning the vector - the interceptors will not change at runtime and array access is faster and easier than vector access

 o getDocumentBase
 public URL getDocumentBase()
Note: getDocumentBase() is deprecated. - use getDocBase and URLUtil if you need it as URL NOT USED INSIDE TOMCAT - ONLY IN OLD J2EE CONNECTORS !

 o setDocumentBase
 public void setDocumentBase(URL s)
Note: setDocumentBase() is deprecated. - use setDocBase


All Packages  Class Hierarchy  This Package  Previous  Next  Index