org.apache.tomcat.core
Class Container

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

public class Container
extends java.lang.Object
implements java.lang.Cloneable

A group of resources, with some common properties. Container is similar with Apache "dir_conf" structue. A container will be selected by best-matching using the alghoritms described in the servlet API. The matching container will determine the handler and the security properties associated with the request. It will also have a chance to add a number of per/container interceptors. In Servlet terminology there are many types of containers: virtual host, context, prefix map, extension map, security prefix and extension maps. It is possible to add/remove containers at runtime (usefull for Invoker or Jsp servlet - if they want to avoid double servlet call overhead ). To make this possible for Jsps we also need to factor out the dependency check and reloading.


Field Summary
static int DEFAULT_MAP
           
static int EXTENSION_MAP
           
static int PATH_MAP
           
static int PREFIX_MAP
           
static int UNKNOWN_MAP
           
 
Constructor Summary
Container()
           
 
Method Summary
 void addContextInterceptor(ContextInterceptor ci)
          Add a per/container context interceptor.
 void addRequestInterceptor(RequestInterceptor ci)
          Add a per/container request interceptor.
 java.lang.Object getAttribute(java.lang.String name)
          Per container attributes.
 java.util.Enumeration getAttributeNames()
          Per container attributes.
 Container getClone()
           
 Context getContext()
          The parent web application, if any.
 ContextInterceptor[] getContextInterceptors()
          Return the context interceptors as an array.
 ContextManager getContextManager()
          Get the context manager
 ServletWrapper getHandler()
          The handler for this container
 int getMapType()
          Return the type of the mapping ( extension, prefix, default, etc)
 java.lang.String[] getMethods()
          If not null, this container can only be accessed by users in roles.
 java.lang.Object getNote(int pos)
           
 java.lang.String getPath()
          Return the path
 java.lang.String getProtocol()
          Protocol matching.
 RequestInterceptor[] getRequestInterceptors()
          Return the context interceptors as an array.
 java.lang.String[] getRoles()
          If not null, this container can only be accessed by users in roles.
 java.lang.String getTransport()
          The transport - another component of the matching.
 java.lang.String[] getVhosts()
          Any alias that can match a particular vhost
 void removeAttribute(java.lang.String name)
          Per container attributes.
 void setAttribute(java.lang.String name, java.lang.Object object)
          Per container attributes.
 void setContext(Context ctx)
          Set the context, if this container is part of a web application.
 void setContextManager(ContextManager cm)
           
 void setHandler(ServletWrapper h)
          The handler ( servlet ) for this container
 void setMethods(java.lang.String[] m)
          If not null, this container can only be accessed by users in roles.
 void setNote(int pos, java.lang.Object value)
          See ContextManager comments.
 void setPath(java.lang.String path)
          The mapping string that creates this Container.
 void setProtocol(java.lang.String protocol)
          Set the protocol - if it's set it will be used in mapping
 void setRoles(java.lang.String[] roles)
          If not null, this container can only be accessed by users in roles.
 void setTransport(java.lang.String transport)
          The transport - another component of the matching.
 void setVhosts(java.lang.String[] vhosts)
          Any alias that can match a particular vhost
 java.lang.String toString()
          Print a short string describing the mapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_MAP

public static final int UNKNOWN_MAP

PATH_MAP

public static final int PATH_MAP

PREFIX_MAP

public static final int PREFIX_MAP

EXTENSION_MAP

public static final int EXTENSION_MAP

DEFAULT_MAP

public static final int DEFAULT_MAP
Constructor Detail

Container

public Container()
Method Detail

getContextManager

public ContextManager getContextManager()
Get the context manager

setContextManager

public void setContextManager(ContextManager cm)

setContext

public void setContext(Context ctx)
Set the context, if this container is part of a web application. Right now all container in use have a context.

getContext

public Context getContext()
The parent web application, if any.

getMapType

public int getMapType()
Return the type of the mapping ( extension, prefix, default, etc)

setPath

public void setPath(java.lang.String path)
The mapping string that creates this Container. Not that this is an un-parsed string, like a regexp.

getPath

public java.lang.String getPath()
Return the path

setProtocol

public void setProtocol(java.lang.String protocol)
Set the protocol - if it's set it will be used in mapping

getProtocol

public java.lang.String getProtocol()
Protocol matching. With Servlet 2.2 the protocol can be used only with security mappings, not with handler ( servlet ) maps

setTransport

public void setTransport(java.lang.String transport)
The transport - another component of the matching. Defined only for security mappings.

getTransport

public java.lang.String getTransport()
The transport - another component of the matching. Defined only for security mappings.

getVhosts

public java.lang.String[] getVhosts()
Any alias that can match a particular vhost

setVhosts

public void setVhosts(java.lang.String[] vhosts)
Any alias that can match a particular vhost

getMethods

public java.lang.String[] getMethods()
If not null, this container can only be accessed by users in roles.

setMethods

public void setMethods(java.lang.String[] m)
If not null, this container can only be accessed by users in roles.

getHandler

public ServletWrapper getHandler()
The handler for this container

setHandler

public void setHandler(ServletWrapper h)
The handler ( servlet ) for this container

getRoles

public java.lang.String[] getRoles()
If not null, this container can only be accessed by users in roles.

setRoles

public void setRoles(java.lang.String[] roles)
If not null, this container can only be accessed by users in roles.

addContextInterceptor

public void addContextInterceptor(ContextInterceptor ci)
Add a per/container context interceptor. It will be notified of all context events happening inside this container. XXX incomplete implementation

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

addRequestInterceptor

public void addRequestInterceptor(RequestInterceptor ci)
Add a per/container request interceptor. It will be called back for all operations for requests that are mapped to this container. Note that all global interceptors will be called first. XXX incomplete implementation.

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

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Per container attributes. Not used - can be removed ( it's here for analogy with the other components )

getAttributeNames

public java.util.Enumeration getAttributeNames()
Per container attributes. Not used - can be removed ( it's here for analogy with the other components )

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object object)
Per container attributes. Not used - can be removed ( it's here for analogy with the other components )

removeAttribute

public void removeAttribute(java.lang.String name)
Per container attributes. Not used - can be removed ( it's here for analogy with the other components )

toString

public java.lang.String toString()
Print a short string describing the mapping
Overrides:
toString in class java.lang.Object

getClone

public Container getClone()

setNote

public void setNote(int pos,
                    java.lang.Object value)
See ContextManager comments.

getNote

public java.lang.Object getNote(int pos)


Copyright © 2000 Apache Software Foundation. All Rights Reserved.