All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.apache.tomcat.core.ContextManager

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

public class ContextManager
extends Object
A collection class representing the Contexts associated with a particular Server. The managed Contexts can be accessed by path. It also store global default properties - the server name and port ( returned by getServerName(), etc) and workdir.

Author:
James Duncan Davidson [duncan@eng.sun.com], James Todd [gonzo@eng.sun.com], Harish Prabandham

Variable Index

 o DEFAULT_HOSTNAME
 o DEFAULT_PORT
 o DEFAULT_WORK_DIR

Constructor Index

 o ContextManager()
Construct a new ContextManager instance with default values.

Method Index

 o addContainer(Container)
 o addContext(Context)
Adds a new Context to the set managed by this ContextManager.
 o addContextInterceptor(ContextInterceptor)
 o addLogger(Logger)
 o addRequestInterceptor(RequestInterceptor)
 o addServerConnector(ServerConnector)
Add the specified server connector to the those attached to this server.
 o doLog(String)
 o doLog(String, Throwable)
 o getConnectors()
 o getContext(String)
Gets a context by it's name, or null if there is no such context.
 o getContextInterceptors()
Return the context interceptors as an array.
 o getContextNames()
Get the names of all the contexts in this server.
 o getDebug()
 o getHome()
The root directory of tomcat
 o getHostName()
Gets the virtual host name of this server. Deprecated.
 o getPort()
Gets the port number on which this server listens. Deprecated.
 o getRequestInterceptors()
Return the context interceptors as an array.
 o getTomcatHome()
Tomcat installation directory, where libraries and default files are located
 o getWorkDir()
 o init()
Init() is called after the context manager is set up and configured.
 o initContext(Context)
Initializes this context to take on requests.
 o log(String)
 o removeContainer(Container)
 o removeContext(String)
Shut down and removes a context from service.
 o service(Request, Response)
Common for all connectors, needs to be shared in order to avoid code duplication
 o setDebug(int)
 o setDefaults()
Set default settings ( interceptors, connectors, loader, manager ) It is called from init if no connector is set up - note that we try to avoid any "magic" - you either set up everything ( using server.xml or alternatives) or you don't set up and then defaults will be used.
 o setHome(String)
Set installation directory.
 o setHostName(String)
Sets the virtual host name of this server. Deprecated.
 o setPort(int)
Sets the port number on which this server listens. Deprecated.
 o setTomcatHome(String)
 o setWorkDir(String)
WorkDir property - where all temporary files will be created
 o shutdownContext(Context)
 o start()
Will start the connectors and begin serving requests
 o stop()

Variables

 o DEFAULT_HOSTNAME
 public static final String DEFAULT_HOSTNAME
 o DEFAULT_PORT
 public static final int DEFAULT_PORT
 o DEFAULT_WORK_DIR
 public static final String DEFAULT_WORK_DIR

Constructors

 o ContextManager
 public ContextManager()
Construct a new ContextManager instance with default values.

Methods

 o setDefaults
 public void setDefaults()
Set default settings ( interceptors, connectors, loader, manager ) It is called from init if no connector is set up - note that we try to avoid any "magic" - you either set up everything ( using server.xml or alternatives) or you don't set up and then defaults will be used. Set interceptors or call setDefaults before adding contexts.

 o getContextNames
 public Enumeration getContextNames()
Get the names of all the contexts in this server.

 o init
 public void init() throws TomcatException
Init() is called after the context manager is set up and configured.

 o initContext
 public void initContext(Context ctx) throws TomcatException
Initializes this context to take on requests. This action will cause the context to load it's configuration information from the webapp directory in the docbase.

This method may only be called once and must be called before any requests are handled by this context and after setContextManager() is called.

 o shutdownContext
 public void shutdownContext(Context ctx) throws TomcatException
 o start
 public void start() throws Exception
Will start the connectors and begin serving requests

 o stop
 public void stop() throws Exception
 o getContext
 public Context getContext(String name)
Gets a context by it's name, or null if there is no such context.

Parameters:
name - Name of the requested context
 o addContext
 public void addContext(Context ctx) throws TomcatException
Adds a new Context to the set managed by this ContextManager.

Parameters:
ctx - context to be added.
 o removeContext
 public void removeContext(String name) throws TomcatException
Shut down and removes a context from service.

Parameters:
name - Name of the Context to be removed
 o addContainer
 public void addContainer(Container container) throws TomcatException
 o removeContainer
 public void removeContainer(Container container) throws TomcatException
 o addServerConnector
 public synchronized void addServerConnector(ServerConnector con)
Add the specified server connector to the those attached to this server.

Parameters:
con - The new server connector
 o getConnectors
 public Enumeration getConnectors()
 o addRequestInterceptor
 public void addRequestInterceptor(RequestInterceptor ri)
 o getRequestInterceptors
 public RequestInterceptor[] getRequestInterceptors()
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 addContextInterceptor
 public void addContextInterceptor(ContextInterceptor ci)
 o getContextInterceptors
 public ContextInterceptor[] getContextInterceptors()
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 addLogger
 public void addLogger(Logger logger)
 o getHome
 public String getHome()
The root directory of tomcat

 o getTomcatHome
 public String getTomcatHome()
Tomcat installation directory, where libraries and default files are located

 o setTomcatHome
 public void setTomcatHome(String tH)
 o setHome
 public void setHome(String home)
Set installation directory. If path specified is relative, evaluate it relative to the current working directory. This is used for the home attribute and it's used to find webapps and conf. Note that libs are probably already configured, so it will not affect that.

 o setPort
 public void setPort(int port)
Note: setPort() is deprecated.

Sets the port number on which this server listens.

Parameters:
port - The new port number
 o getPort
 public int getPort()
Note: getPort() is deprecated.

Gets the port number on which this server listens.

 o setHostName
 public void setHostName(String host)
Note: setHostName() is deprecated.

Sets the virtual host name of this server.

Parameters:
host - The new virtual host name
 o getHostName
 public String getHostName()
Note: getHostName() is deprecated.

Gets the virtual host name of this server.

 o setWorkDir
 public void setWorkDir(String wd)
WorkDir property - where all temporary files will be created

 o getWorkDir
 public String getWorkDir()
 o service
 public void service(Request rrequest,
                     Response rresponse)
Common for all connectors, needs to be shared in order to avoid code duplication

 o setDebug
 public void setDebug(int level)
 o getDebug
 public int getDebug()
 o log
 public final void log(String msg)
 o doLog
 public final void doLog(String msg)
 o doLog
 public final void doLog(String msg,
                         Throwable t)

All Packages  Class Hierarchy  This Package  Previous  Next  Index