|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tomcat.core.ContextManager
ContextManager controls requests processing and server configuration. It maintains a list of Contexts ( web applications ) and a list of global modules that deal with server configuration and request processing, and global properties ( directories, general settings, etc ). The request processing is similar with Apache and other servers, with the addition of a "contextMap" chain that will select a tomcat-specific.
Field Summary | |
static int |
CONTAINER_NOTE
|
static int |
HANDLER_NOTE
|
static int |
MAX_NOTES
Maximum number of notes supported |
static int |
MODULE_NOTE
|
static int |
NOTE_COUNT
Note id counters. |
static int |
REQ_RE_NOTE
|
static int |
REQUEST_NOTE
|
static int |
RESERVED
|
static int |
SERVER_NOTE
|
static int |
SESSION_NOTE
|
static int |
STATE_CONFIG
Server and global modules are initialized and stable. |
static int |
STATE_INIT
Web applications are configured and initialized. |
static int |
STATE_NEW
Server is beeing configured - modules are added. |
static int |
STATE_START
Server is started and may process requests. |
static java.lang.String |
TOMCAT_HOME
System property used to set the base directory ( tomcat home ). |
static java.lang.String |
TOMCAT_INSTALL
System property used to set the install directory ( tomcat install ). |
static java.lang.String |
TOMCAT_NAME
|
static java.lang.String |
TOMCAT_VERSION
Official name and version |
Constructor Summary | |
ContextManager()
Construct a new ContextManager instance with default values. |
Method Summary | |
void |
addContext(Context ctx)
Adds a new Context to the set managed by this ContextManager. |
void |
addInterceptor(BaseInterceptor ri)
Add a global interceptor. |
Container |
createContainer()
|
Context |
createContext()
|
OutputBuffer |
createOutputBuffer()
|
OutputBuffer |
createOutputBuffer(int size)
|
Request |
createRequest()
|
Request |
createRequest(Context ctx,
java.lang.String urlPath)
Create a new sub-request in a given context, set the context "hint" This is a particular case of sub-request that can't get out of a context ( and we know the context before - so no need to compute it again) Note that session and all stuff will still be computed. |
Response |
createResponse(Request req)
|
ServerSession |
createServerSession()
|
java.lang.ClassLoader |
getAppsLoader()
|
java.lang.ClassLoader |
getCommonLoader()
|
Container |
getContainer()
Default container. |
java.lang.ClassLoader |
getContainerLoader()
|
Context |
getContext(Context base,
java.lang.String path)
Find a context by doing a sub-request and mapping the request against the active rules ( that means you could use a /~costin if a UserHomeInterceptor is present ) The new context will be in the same virtual host as base. |
Context |
getContext(java.lang.String name)
|
java.util.Enumeration |
getContextNames()
|
java.util.Enumeration |
getContexts()
Return the list of contexts managed by this server. |
int |
getDebug()
|
java.lang.String |
getHome()
|
java.lang.String |
getInstallDir()
Get installation directory. |
Log |
getLog()
So other classes can piggyback on the context manager's log stream. |
java.lang.Object |
getNote(int pos)
|
java.lang.Object |
getNote(java.lang.String name)
|
int |
getNoteId(int noteType,
java.lang.String name)
Create a new note id. |
java.lang.String |
getNoteName(int noteType,
int noteId)
|
java.lang.ClassLoader |
getParentLoader()
|
java.util.Hashtable |
getProperties()
|
java.lang.String |
getProperty(java.lang.String name)
Generic properties support. |
int |
getState()
Return the current state of the tomcat server. |
java.lang.String |
getWorkDir()
|
void |
handleError(Request req,
Response res,
java.lang.Throwable t)
Call error hook with an exception code. |
void |
handleStatus(Request req,
Response res,
int code)
Called for error-codes. |
void |
init()
Init() is called after the context manager is set up (properties) and configured ( modules ). |
void |
initRequest(Request req,
Response resp)
Prepare the req/resp pair for use in tomcat. |
void |
log(java.lang.String msg)
|
void |
log(java.lang.String msg,
int level)
|
void |
log(java.lang.String msg,
java.lang.Throwable t)
|
void |
log(java.lang.String msg,
java.lang.Throwable t,
int level)
|
int |
processRequest(Request req)
Will find the Handler for a servlet, assuming we already have the Context. |
void |
removeContext(Context context)
Shut down and removes a context from service. |
void |
removeInterceptor(BaseInterceptor ri)
Remove a module. |
void |
service(Request req,
Response res)
This is the entry point in tomcat - the connectors ( or any other component able to generate Request/Response implementations ) will call this method to get it processed. |
void |
setAppsLoader(java.lang.ClassLoader cl)
|
void |
setCommonLoader(java.lang.ClassLoader cl)
|
void |
setContainer(Container newDefaultContainer)
|
void |
setContainerLoader(java.lang.ClassLoader cl)
|
void |
setDebug(int level)
Debug level |
void |
setHome(java.lang.String home)
The home of the tomcat instance - you can have multiple users running tomcat, with a shared install directory. |
void |
setInstallDir(java.lang.String tH)
|
void |
setLog(Log log)
|
void |
setNote(int pos,
java.lang.Object value)
|
void |
setNote(java.lang.String name,
java.lang.Object value)
|
void |
setParentLoader(java.lang.ClassLoader cl)
Parent loader is the "base" class loader of the application that starts tomcat, and includes no tomcat classes. |
void |
setProperty(java.lang.String name,
java.lang.String value)
|
void |
setState(int state)
Change the state, after notifying all modules about the change Any error will be propagated - the server will not change the state and should fail if any module can't handle that. |
protected void |
setState1(int state)
|
void |
setWorkDir(java.lang.String wd)
WorkDir property - where all working files will be created |
void |
shutdown()
Remove all contexts. |
void |
start()
Will start the connectors and begin serving requests. |
void |
stop()
Will stop all connectors |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String TOMCAT_VERSION
public static final java.lang.String TOMCAT_NAME
public static final java.lang.String TOMCAT_HOME
public static final java.lang.String TOMCAT_INSTALL
public static final int STATE_NEW
public static final int STATE_CONFIG
public static final int STATE_INIT
public static final int STATE_START
public static final int NOTE_COUNT
public static final int MAX_NOTES
public static final int RESERVED
public static final int SERVER_NOTE
public static final int CONTAINER_NOTE
public static final int REQUEST_NOTE
public static final int HANDLER_NOTE
public static final int SESSION_NOTE
public static final int MODULE_NOTE
public static final int REQ_RE_NOTE
Constructor Detail |
public ContextManager()
Method Detail |
public void setHome(java.lang.String home)
public java.lang.String getHome()
public java.lang.String getInstallDir()
public void setInstallDir(java.lang.String tH)
public void setWorkDir(java.lang.String wd)
public java.lang.String getWorkDir()
public void setDebug(int level)
public final int getDebug()
public java.lang.String getProperty(java.lang.String name)
public void setProperty(java.lang.String name, java.lang.String value)
public java.util.Hashtable getProperties()
public final int getState()
public void setState(int state) throws TomcatException
TomcatException
protected void setState1(int state)
public void setParentLoader(java.lang.ClassLoader cl)
parentLoader -> tomcat.core.loader [ -> trusted.webapp.loader ] -> webapp.loaders
public java.lang.ClassLoader getParentLoader()
public void setCommonLoader(java.lang.ClassLoader cl)
public java.lang.ClassLoader getCommonLoader()
public void setContainerLoader(java.lang.ClassLoader cl)
public java.lang.ClassLoader getContainerLoader()
public void setAppsLoader(java.lang.ClassLoader cl)
public java.lang.ClassLoader getAppsLoader()
public Container getContainer()
public void setContainer(Container newDefaultContainer)
public void addInterceptor(BaseInterceptor ri) throws TomcatException
TomcatException
public void removeInterceptor(BaseInterceptor ri) throws TomcatException
TomcatException
public void init() throws TomcatException
TomcatException
public void start() throws TomcatException
TomcatException
public void stop() throws TomcatException
TomcatException
public void shutdown() throws TomcatException
TomcatException
public java.util.Enumeration getContexts()
public java.util.Enumeration getContextNames()
public Context getContext(java.lang.String name)
public void addContext(Context ctx) throws TomcatException
ctx
- context to be added.
TomcatException
public void removeContext(Context context) throws TomcatException
TomcatException
public void initRequest(Request req, Response resp)
public void service(Request req, Response res)
public int processRequest(Request req)
public Request createRequest(Context ctx, java.lang.String urlPath)
public Context getContext(Context base, java.lang.String path)
public void handleStatus(Request req, Response res, int code)
public void handleError(Request req, Response res, java.lang.Throwable t)
public int getNoteId(int noteType, java.lang.String name) throws TomcatException
noteType
- The note will be associated with the server,
container or request.name
- the name of the note.
TomcatException
public java.lang.String getNoteName(int noteType, int noteId)
public final void setNote(int pos, java.lang.Object value)
public final java.lang.Object getNote(int pos)
public java.lang.Object getNote(java.lang.String name) throws TomcatException
TomcatException
public void setNote(java.lang.String name, java.lang.Object value) throws TomcatException
TomcatException
public Log getLog()
public void setLog(Log log)
public void log(java.lang.String msg)
public void log(java.lang.String msg, java.lang.Throwable t)
public void log(java.lang.String msg, int level)
public void log(java.lang.String msg, java.lang.Throwable t, int level)
public Context createContext()
public Request createRequest()
public Response createResponse(Request req)
public Container createContainer()
public OutputBuffer createOutputBuffer()
public OutputBuffer createOutputBuffer(int size)
public ServerSession createServerSession()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |