|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tomcat.core.ContextManager
ContextManager is the entry point and "controler" of the servlet execution. It maintains a list of WebApplications and a list of global event interceptors that are set up to handle the actual execution. The ContextManager is a helper that will direct the request processing flow from its arrival from the server/protocl adapter ( in service() ). It is also responsible for controlling the request processing steps, from request parsing and mapping, auth, autorization, pre/post service, actual invocation and logging. It will also store properties that are global to the servlet container - like root directory, install dir, work dir.
Field Summary | |
static int |
ACC_INIT_END
|
static int |
ACC_INIT_START
|
static int |
ACCOUNTS
|
static int |
CONTAINER_NOTE
|
static java.lang.String |
DEFAULT_HOSTNAME
|
static int |
DEFAULT_PORT
|
static java.lang.String |
DEFAULT_WORK_DIR
Default work dir, relative to home |
static int |
HANDLER_NOTE
|
static int |
MAX_NOTES
Maximum number of notes supported |
static int |
REQ_RE_NOTE
|
static int |
REQUEST_NOTE
|
static int |
RESERVED
|
static int |
SERVER_NOTE
|
Constructor Summary | |
ContextManager()
Construct a new ContextManager instance with default values. |
Method Summary | |
void |
addContainer(Container container)
Notify interceptors that a new container was added. |
void |
addContext(Context ctx)
Adds a new Context to the set managed by this ContextManager. |
void |
addContextInterceptor(ContextInterceptor ci)
|
void |
addLogger(org.apache.tomcat.logging.Logger l)
|
void |
addRequestInterceptor(RequestInterceptor ri)
|
void |
addServerConnector(ServerConnector con)
Add the specified server connector to the those attached to this server. |
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. |
Request |
createRequest(java.lang.String urlPath)
Create a new sub-request, deal with query string |
int |
doAuthenticate(Request req,
Response res)
Call all authentication callbacks. |
int |
doAuthorize(Request req,
Response res,
java.lang.String[] roles)
Call all authorization callbacks. |
void |
doLog(java.lang.String msg)
|
void |
doLog(java.lang.String msg,
java.lang.Throwable t)
|
void |
doLog(java.lang.String msg,
java.lang.Throwable t,
int level)
|
void |
doPostServletDestroy(Context ctx,
ServletWrapper sw)
|
void |
doPostServletInit(Context ctx,
ServletWrapper sw)
|
void |
doPreServletDestroy(Context ctx,
ServletWrapper sw)
|
void |
doPreServletInit(Context ctx,
ServletWrapper sw)
|
java.io.File |
getAbsolute(java.io.File f)
Convert a relative name to absolute by using the "home" property |
long |
getAccount(int pos)
|
java.util.Enumeration |
getConnectors()
|
Context |
getContext(java.lang.String name)
Deprecated. Use an external iterator to find the context that matches your conditions. |
ContextInterceptor[] |
getContextInterceptors()
Return the context interceptors as an array. |
java.util.Enumeration |
getContextNames()
Deprecated. Path is not "unique key". |
java.util.Enumeration |
getContexts()
Return the list of contexts managed by this server |
int |
getDebug()
|
ServletWrapper |
getHandlerForPath(Context ctx,
java.lang.String path)
|
java.lang.String |
getHome()
The home of the tomcat instance - you can have multiple users running tomcat, with a shared install directory. |
java.lang.String |
getHostName()
Deprecated. |
java.lang.String |
getInstallDir()
Get installation directory, where libraries and default files are located. |
java.lang.Object |
getNote(int pos)
|
int |
getNoteId(int noteType,
java.lang.String name)
Create a new note id. |
java.lang.String |
getNoteName(int noteType,
int noteId)
|
java.lang.Object |
getPermissions()
Get the default Security Permissions for this server |
int |
getPort()
Deprecated. |
java.lang.String |
getRandomClass()
Get the name of the class to be used for generating random numbers by the session id generator. |
RequestInterceptor[] |
getRequestInterceptors()
Return the context interceptors as an array. |
RequestInterceptor[] |
getRequestInterceptors(Request req)
Return all the interceptors associated with a request. |
int |
getSecurePort()
|
java.lang.String |
getTomcatHome()
Deprecated. |
java.lang.String |
getWorkDir()
WorkDir property - where all working files will be created |
void |
handleStatus(Request req,
Response res,
int code)
Called for error-codes |
void |
init()
Init() is called after the context manager is set up and configured. |
void |
initContext(Context ctx)
Initializes this context to be able to accept requests. |
void |
initRequest(Request req,
Response resp)
Prepare the req/resp pair for use in tomcat. |
void |
log(java.lang.String msg)
|
int |
processRequest(Request req)
Will find the ServletWrapper for a servlet, assuming we already have the Context. |
void |
removeContainer(Container container)
Notify interceptors that a container was removed. |
void |
removeContext(Context context)
Shut down and removes a context from service |
void |
removeContext(java.lang.String name)
Deprecated. Use removeContext( Context ). |
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 |
setAccount(int pos,
long value)
|
void |
setDebug(int level)
|
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. |
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 |
setHostName(java.lang.String host)
Deprecated. |
void |
setInstallDir(java.lang.String tH)
Set installation directory, where libraries and default files are located. |
void |
setNote(int pos,
java.lang.Object value)
|
void |
setPermissions(java.lang.Object permissions)
Add a Permission to the default Permissions |
void |
setPort(int port)
Deprecated. |
void |
setRandomClass(java.lang.String randomClass)
Sets the name of the class used for generating random numbers by the session id generator. |
void |
setSecurePort(int p)
Secure port is set to the SSL connector that will handle INTEGRAL/CONFIDENTIAL transport. |
void |
setTomcatHome(java.lang.String s)
Deprecated. |
void |
setWorkDir(java.lang.String wd)
WorkDir property - where all working files will be created |
void |
shutdown()
Will shutdown all contexts |
void |
shutdownContext(Context ctx)
Stop the context and release all resources. |
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 DEFAULT_WORK_DIR
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 REQ_RE_NOTE
public static final int ACC_INIT_START
public static final int ACC_INIT_END
public static final int ACCOUNTS
public static final java.lang.String DEFAULT_HOSTNAME
public static final int DEFAULT_PORT
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 int getSecurePort()
public void setSecurePort(int p)
public void setWorkDir(java.lang.String wd)
public java.lang.String getWorkDir()
public java.lang.Object getPermissions()
public void setPermissions(java.lang.Object permissions)
public java.lang.String getRandomClass()
java.security.SecureRandom
.public void setRandomClass(java.lang.String randomClass)
public void setDefaults()
public void init() throws TomcatException
public void shutdown() throws TomcatException
public void initContext(Context ctx) throws TomcatException
This method must be called before any requests are handled by this context. It will be called after the context was added, typically when the engine starts or after the admin added a new context.
public void shutdownContext(Context ctx) throws TomcatException
public void start() throws java.lang.Exception
public void stop() throws java.lang.Exception
public java.util.Enumeration getContexts()
public void addContext(Context ctx) throws TomcatException
ctx
- context to be added.public void removeContext(Context context) throws TomcatException
public void addContainer(Container container) throws TomcatException
public void removeContainer(Container container) throws TomcatException
public void addServerConnector(ServerConnector con)
con
- The new server connectorpublic java.util.Enumeration getConnectors()
public void addRequestInterceptor(RequestInterceptor ri)
public RequestInterceptor[] getRequestInterceptors(Request req)
public RequestInterceptor[] getRequestInterceptors()
public void addContextInterceptor(ContextInterceptor ci)
public ContextInterceptor[] getContextInterceptors()
public void initRequest(Request req, Response resp)
public void service(Request req, Response res)
public int processRequest(Request req)
public int doAuthenticate(Request req, Response res)
public int doAuthorize(Request req, Response res, java.lang.String[] roles)
public Request createRequest(Context ctx, java.lang.String urlPath)
public Request createRequest(java.lang.String urlPath)
public void handleStatus(Request req, Response res, int code)
public ServletWrapper getHandlerForPath(Context ctx, java.lang.String path)
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.public java.lang.String getNoteName(int noteType, int noteId)
public void setNote(int pos, java.lang.Object value)
public java.lang.Object getNote(int pos)
public void addLogger(org.apache.tomcat.logging.Logger l)
public void setDebug(int level)
public int getDebug()
public final void log(java.lang.String msg)
public final void doLog(java.lang.String msg)
public final void doLog(java.lang.String msg, java.lang.Throwable t)
public final void doLog(java.lang.String msg, java.lang.Throwable t, int level)
public void setAccount(int pos, long value)
public long getAccount(int pos)
public void setPort(int port)
port
- The new port numberpublic int getPort()
public void setHostName(java.lang.String host)
host
- The new virtual host namepublic java.lang.String getHostName()
public java.util.Enumeration getContextNames()
public Context getContext(java.lang.String name)
null
if there is
no such context.name
- Name of the requested contextpublic void removeContext(java.lang.String name) throws TomcatException
name
- Name of the Context to be removedpublic void doPreServletInit(Context ctx, ServletWrapper sw) throws TomcatException
public void doPostServletInit(Context ctx, ServletWrapper sw) throws TomcatException
public void doPreServletDestroy(Context ctx, ServletWrapper sw) throws TomcatException
public void doPostServletDestroy(Context ctx, ServletWrapper sw) throws TomcatException
public void setTomcatHome(java.lang.String s)
public java.lang.String getTomcatHome()
public java.io.File getAbsolute(java.io.File f)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |