## org.apache.catalina
Interface Host

All Superinterfaces:
  Container

All Known Implementing Classes:
  StandardHost

public interface Host
extends Container

A Host is a Container that represents a virtual host in the Catalina servlet engine. It is useful in the following types of scenarios:

- You wish to use Interceptors that see every single request processed by this particular virtual host.
- You wish to run Catalina in with a standalone HTTP connector, but still want support for multiple virtual hosts.

In general, you would not use a Host when deploying Catalina connected to a web server (such as Apache), because the Connector will have utilized the web server's facilities to determine which Context (or perhaps even which Wrapper) should be utilized to process this request.

The parent Container attached to a Host is generally an Engine, but may be some other implementation, or may be omitted if it is not necessary.

The child containers attached to a Host are generally implementations of Context (representing an individual servlet context).

Version:
  $Revision: 1.10 $ $Date: 2004/08/26 22:05:20 $
Author:
  Craig R. McClanahan

Field Summary
`static java.lang.String` `ADD_ALIAS_EVENT` The ContainerEvent event type sent when a new alias is added by `addAlias()`.
`static java.lang.String` `REMOVE_ALIAS_EVENT` The ContainerEvent event type sent when an old alias is removed by `removeAlias()`.

Fields inherited from interface org.apache.catalina.Container
`ADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENT`

Method Summary
`void` `addAlias(java.lang.String alias)` Add an alias name that should be mapped to this same Host.
`void` `addDefaultContext(DefaultContext defaultContext)` Set the DefaultContext for new web applications.
`java.lang.String[]` `findAliases()` Return the set of alias names for this Host.
`java.lang.String` `getAppBase()` Return the application root for this Host.
`boolean` `getAutoDeploy()` Return the value of the auto deploy flag.
`DefaultContext` `getDefaultContext()` Retrieve the DefaultContext for new web applications.
`java.lang.String` `getName()` Return the canonical, fully qualified, name of the virtual host this Container represents.
`void` `importDefaultContext(Context context)` Import the DefaultContext config into a web application context.
`Context` `map(java.lang.String uri)` Return the Context that would be used to process the specified host-relative request URI, if any; otherwise return `null`.
`void` `removeAlias(java.lang.String alias)` Remove the specified alias name from the aliases for this Host.
`void` `setAppBase(java.lang.String appBase)` Set the application root for this Host.
`void` `setAutoDeploy(boolean autoDeploy)` Set the auto deploy flag value for this host.
`void` `setName(java.lang.String name)` Set the canonical, fully qualified, name of the virtual host this Container represents.

Methods inherited from interface org.apache.catalina.Container

`addChild, addContainerListener, addMapper, addPropertyChangeListener, findChild, findChildren, findContainerListeners, findMapper, findMappers, getCluster, getInfo, getLoader, getLogger, getManager, getParent, getParentClassLoader, getRealm, getResources, invoke, map, removeChild, removeContainerListener, removeMapper, removePropertyChangeListener, setCluster, setLoader, setLogger, setManager, setParent, setParentClassLoader, setRealm, setResources`

Field Detail

### ADD_ALIAS_EVENT

    public static final java.lang.String ADD_ALIAS_EVENT

  The ContainerEvent event type sent when a new alias is added by `addAlias()`.

  See Also:
    Constant Field Values

### REMOVE_ALIAS_EVENT

    public static final java.lang.String REMOVE_ALIAS_EVENT

  The ContainerEvent event type sent when an old alias is removed by `removeAlias()`.

  See Also:
    Constant Field Values

Method Detail

### getAppBase

    public java.lang.String getAppBase()

  Return the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.

### setAppBase

    public void setAppBase(java.lang.String appBase)

  Set the application root for this Host. This can be an absolute pathname, a relative pathname, or a URL.

  Parameters:
    `appBase` - The new application root

### getAutoDeploy

    public boolean getAutoDeploy()

  Return the value of the auto deploy flag. If true, it indicates that this host's child webapps should be discovred and automatically deployed.

### setAutoDeploy

    public void setAutoDeploy(boolean autoDeploy)

  Set the auto deploy flag value for this host.

  Parameters:
    `autoDeploy` - The new auto deploy flag

### addDefaultContext

    public void addDefaultContext(DefaultContext defaultContext)

  Set the DefaultContext for new web applications.

  Parameters:
    `defaultContext` - The new DefaultContext

### getDefaultContext

    public DefaultContext getDefaultContext()

  Retrieve the DefaultContext for new web applications.

### getName

    public java.lang.String getName()

  Return the canonical, fully qualified, name of the virtual host this Container represents.

  Specified by:
    `getName` in interface `Container`

### setName

    public void setName(java.lang.String name)

  Set the canonical, fully qualified, name of the virtual host this Container represents.

  Specified by:
    `setName` in interface `Container`
  Parameters:
    `name` - Virtual host name
  Throws:
    `java.lang.IllegalArgumentException` - if name is null

### importDefaultContext

    public void importDefaultContext(Context context)

  Import the DefaultContext config into a web application context.

  Parameters:
    `context` - web application context to import default context

### addAlias

    public void addAlias(java.lang.String alias)

  Add an alias name that should be mapped to this same Host.

  Parameters:
    `alias` - The alias to be added

### findAliases

    public java.lang.String[] findAliases()

  Return the set of alias names for this Host. If none are defined, a zero length array is returned.

### map

    public Context map(java.lang.String uri)

  Return the Context that would be used to process the specified host-relative request URI, if any; otherwise return `null`.

  Parameters:
    `uri` - Request URI to be mapped

### removeAlias

    public void removeAlias(java.lang.String alias)

  Remove the specified alias name from the aliases for this Host.

  Parameters:
    `alias` - Alias name to be removed

Copyright ? 2000-2002 Apache Software Foundation. All Rights Reserved.