Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tomcat.core
Class Container

    java.lang.Object
      org.apache.tomcat.core.Container

All Implemented Interfaces:
  java.lang.Cloneable

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. Each Context has a default Container and one container for each URL property ( mapping handlers and security constraints ). The ContextManager has a defaultContainer containing global properties. Each time a container is added to a Context, addContainer() hook is called to notify all modules of a new URL property. Modules that implement contextMap/requestMap and security constraints ( authenticate/authorize hooks ) will construct specialized data structures. You can associate trees, hashtables or other data types with the context using notes - no application/module should assume any particular structure is in used, the user can choose any mapper. See SimpleMapper1 for an example of such structures. A container will be selected by best-matching a request using the alghoritms described in the servlet API.

Field Summary
`static int` | `DEFAULT_MAP`
`static int` | `EXTENSION_MAP`
`static int` | `H_afterBody`
`static int` | `H_authenticate`
`static int` | `H_authorize`
`static int` | `H_beforeBody`
`static int` | `H_beforeCommit`
`static int` | `H_contextMap`
`static int` | `H_copyContext`
`static int` | `H_COUNT`
`static int` | `H_engineInit`
`static int` | `H_findSession`
`static int` | `H_getInfo`
`static int` | `H_handleError`
`static int` | `H_postInitCheck`
`static int` | `H_postReadRequest`
`static int` | `H_postRequest`
`static int` | `H_postService`
`static int` | `H_preInitCheck`
`static int` | `H_preService`
`static int` | `H_requestMap`
`static int` | `H_sessionState`
`static int` | `H_setInfo`
`static int` | `PATH_MAP`
`static int` | `PREFIX_MAP`
`static int` | `UNKNOWN_MAP`

Constructor Summary
`Container()`

Method Summary
`void` | `addInterceptor(BaseInterceptor bi)` Add the interceptor to all the hook chains it's interested in
`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.
`ContextManager` | `getContextManager()` Get the context manager
`Handler` | `getHandler()`
`java.lang.String` | `getHandlerName()` The handler name for this container.
`Hooks` | `getHooks()`
`BaseInterceptor[]` | `getInterceptors()` Get all interceptors
`BaseInterceptor[]` | `getInterceptors(int type)`
`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.Object` | `getNote(java.lang.String name)`
`java.lang.String` | `getPath()` Return the path
`java.lang.String` | `getProtocol()` Protocol matching.
`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
`boolean` | `isSpecial()`
`void` | `removeAttribute(java.lang.String name)` Per container attributes.
`void` | `removeInterceptor(BaseInterceptor bi)`
`void` | `resetInterceptorCache(int id)`
`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(Handler h)` The handler ( servlet ) for this container
`void` | `setHandlerName(java.lang.String hn)`
`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` | `setNote(java.lang.String name, java.lang.Object value)`
`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` | `setSpecial(boolean b)`
`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

See Also:
  Constant Field Values

### PATH_MAP

    public static final int PATH_MAP

See Also:
  Constant Field Values

### PREFIX_MAP

    public static final int PREFIX_MAP

See Also:
  Constant Field Values

### EXTENSION_MAP

    public static final int EXTENSION_MAP

See Also:
  Constant Field Values

### DEFAULT_MAP

    public static final int DEFAULT_MAP

See Also:
  Constant Field Values

### H_postReadRequest

    public static final int H_postReadRequest

See Also:
  Constant Field Values

### H_requestMap

    public static final int H_requestMap

See Also:
  Constant Field Values

### H_contextMap

    public static final int H_contextMap

See Also:
  Constant Field Values

### H_authenticate

    public static final int H_authenticate

See Also:
  Constant Field Values

### H_authorize

    public static final int H_authorize

See Also:
  Constant Field Values

### H_preService

    public static final int H_preService

See Also:
  Constant Field Values

### H_beforeBody

    public static final int H_beforeBody

See Also:
  Constant Field Values

### H_findSession

    public static final int H_findSession

See Also:
  Constant Field Values

### H_sessionState

    public static final int H_sessionState

See Also:
  Constant Field Values

### H_beforeCommit

    public static final int H_beforeCommit

See Also:
  Constant Field Values

### H_afterBody

    public static final int H_afterBody

See Also:
  Constant Field Values

### H_postService

    public static final int H_postService

See Also:
  Constant Field Values

### H_postRequest

    public static final int H_postRequest

See Also:
  Constant Field Values

### H_handleError

    public static final int H_handleError

See Also:
  Constant Field Values

### H_getInfo

    public static final int H_getInfo

See Also:
  Constant Field Values

### H_setInfo

    public static final int H_setInfo

See Also:
  Constant Field Values

### H_engineInit

    public static final int H_engineInit

See Also:
  Constant Field Values

### H_preInitCheck

    public static final int H_preInitCheck

See Also:
  Constant Field Values

### H_postInitCheck

    public static final int H_postInitCheck

See Also:
  Constant Field Values

### H_copyContext

    public static final int H_copyContext

See Also:
  Constant Field Values

### H_COUNT

    public static final int H_COUNT

See Also:
  Constant Field Values

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.

### setSpecial

    public void setSpecial(boolean b)

### isSpecial

    public boolean isSpecial()

### 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 Handler getHandler()

### setHandler

    public void setHandler(Handler h)

  The handler ( servlet ) for this container

### setHandlerName

    public void setHandlerName(java.lang.String hn)

### getHandlerName

    public java.lang.String getHandlerName()

  The handler name for this container.

  Returns:
    null if no handler is defined for this container ( this container defines only security or other type of properties, but not a handler )

### 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.

### 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

### getClone

    public Container getClone()

### setNote

    public final void setNote(int pos,
                              java.lang.Object value)

  See ContextManager comments.

### getNote

    public final java.lang.Object getNote(int pos)

### getNote

    public java.lang.Object getNote(java.lang.String name)
                             throws TomcatException

  Throws:
    `TomcatException`

### setNote

    public void setNote(java.lang.String name,
                        java.lang.Object value)
                 throws TomcatException

  Throws:
    `TomcatException`

### getHooks

    public Hooks getHooks()

### addInterceptor

    public void addInterceptor(BaseInterceptor bi)

  Add the interceptor to all the hook chains it's interested in

### removeInterceptor

    public void removeInterceptor(BaseInterceptor bi)

### getInterceptors

    public BaseInterceptor[] getInterceptors(int type)

### getInterceptors

    public BaseInterceptor[] getInterceptors()

  Get all interceptors

### resetInterceptorCache

    public void resetInterceptorCache(int id)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001 Apache Software Foundation. All Rights Reserved.