org.apache.catalina.core
Class StandardHost

java.lang.Object
  |
  +--org.apache.catalina.core.ContainerBase
        |
        +--org.apache.catalina.core.StandardHost
All Implemented Interfaces:
Container, Deployer, Host, Lifecycle, Pipeline

public final class StandardHost
extends ContainerBase
implements Deployer, Host

Standard implementation of the Host interface. Each child container must be a Context implementation to process the requests directed to a particular web application.

Version:
$Revision: 1.5 $ $Date: 2000/10/05 20:25:59 $
Author:
Craig R. McClanahan

Fields inherited from class org.apache.catalina.core.ContainerBase
basic, children, debug, first, lifecycle, listeners, loader, logger, manager, mapper, mapperClass, mappers, name, parent, realm, resources, sm, started, support
 
Fields inherited from interface org.apache.catalina.Deployer
DEPLOY_EVENT, UNDEPLOY_EVENT
 
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
 
Fields inherited from interface org.apache.catalina.Host
ADD_ALIAS_EVENT, REMOVE_ALIAS_EVENT
 
Fields inherited from interface org.apache.catalina.Lifecycle
START_EVENT, STOP_EVENT
 
Constructor Summary
StandardHost()
          Create a new StandardHost component with the default basic Valve.
 
Method Summary
 void addAlias(java.lang.String alias)
          Add an alias name that should be mapped to this same Host.
 void addChild(Container child)
          Add a child Container, only if the proposed child is an implementation of Context.
protected  void addDefaultMapper(java.lang.String mapperClass)
          Add a default Mapper implementation if none have been configured explicitly.
 void deploy(java.lang.String contextPath, java.net.URL war)
          Deploy a new web application, whose web application archive is at the specified URL, into this container with the specified context path.
protected  void expand(java.io.InputStream input, java.io.File docBase, java.lang.String name)
          Expand the specified input stream into the specified directory, creating a file named from the specified relative path.
protected  java.lang.String expand(java.net.URL war)
          Expand the WAR file found at the specified URL into an unpacked directory structure, and return the absolute pathname to the expanded directory.
 java.lang.String[] findAliases()
          Return the set of alias names for this Host.
 Context findDeployedApp(java.lang.String contextPath)
          Return the Context for the deployed application that is associated with the specified context path (if any); otherwise return null.
 java.lang.String[] findDeployedApps()
          Return the context paths of all deployed web applications in this Container.
 java.lang.String getAppBase()
          Return the application root for this Host.
 java.lang.String getConfigClass()
          Return the Java class name of the context configuration class for new web applications.
 java.lang.String getContextClass()
          Return the Java class name of the Context implementation class for new web applications.
 java.lang.String getInfo()
          Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
 java.lang.String getName()
          Return the canonical, fully qualified, name of the virtual host this Container represents.
 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.
protected  void remove(java.io.File dir)
          Remove the specified directory and all of its contents.
 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 setConfigClass(java.lang.String configClass)
          Set the Java class name of the context configuration class for new web applications.
 void setContextClass(java.lang.String contextClass)
          Set the Java class name of the Context implementation class for new web applications.
 void setName(java.lang.String name)
          Set the canonical, fully qualified, name of the virtual host this Container represents.
 java.lang.String toString()
          Return a String representation of this component.
 void undeploy(java.lang.String contextPath)
          Undeploy an existing web application, attached to the specified context path.
 
Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, addLifecycleListener, addMapper, addPropertyChangeListener, addValve, findChild, findChildren, findMapper, findMappers, findValves, fireContainerEvent, getBasic, getDebug, getLast, getLoader, getLogger, getManager, getParent, getParentClassLoader, getRealm, getResources, invoke, log, log, logName, map, removeChild, removeContainerListener, removeLifecycleListener, removeMapper, removePropertyChangeListener, removeValve, setBasic, setDebug, setLoader, setLogger, setManager, setParent, setParentClassLoader, setRealm, setResources, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Container
addContainerListener, addMapper, addPropertyChangeListener, findChild, findChildren, findMapper, findMappers, getLoader, getLogger, getManager, getParent, getParentClassLoader, getRealm, getResources, invoke, map, removeChild, removeContainerListener, removeMapper, removePropertyChangeListener, setLoader, setLogger, setManager, setParent, setParentClassLoader, setRealm, setResources
 

Constructor Detail

StandardHost

public StandardHost()
Create a new StandardHost component with the default basic Valve.
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.
Specified by:
getAppBase in interface Host

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.
Specified by:
setAppBase in interface Host
Parameters:
appBase - The new application root

getConfigClass

public java.lang.String getConfigClass()
Return the Java class name of the context configuration class for new web applications.

setConfigClass

public void setConfigClass(java.lang.String configClass)
Set the Java class name of the context configuration class for new web applications.
Parameters:
configClass - The new context configuration class

getContextClass

public java.lang.String getContextClass()
Return the Java class name of the Context implementation class for new web applications.

setContextClass

public void setContextClass(java.lang.String contextClass)
Set the Java class name of the Context implementation class for new web applications.
Parameters:
contextClass - The new context implementation class

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
Overrides:
getName in class ContainerBase

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
Overrides:
setName in class ContainerBase
Parameters:
name - Virtual host name
Throws:
java.lang.IllegalArgumentException - if name is null

addAlias

public void addAlias(java.lang.String alias)
Add an alias name that should be mapped to this same Host.
Specified by:
addAlias in interface Host
Parameters:
alias - The alias to be added

addChild

public void addChild(Container child)
Add a child Container, only if the proposed child is an implementation of Context.
Specified by:
addChild in interface Container
Overrides:
addChild in class ContainerBase
Parameters:
child - Child container 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.
Specified by:
findAliases in interface Host

getInfo

public java.lang.String getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format <description>/<version>.
Specified by:
getInfo in interface Container
Overrides:
getInfo in class ContainerBase

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.
Specified by:
map in interface Host
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.
Specified by:
removeAlias in interface Host
Parameters:
alias - Alias name to be removed

toString

public java.lang.String toString()
Return a String representation of this component.
Overrides:
toString in class java.lang.Object

deploy

public void deploy(java.lang.String contextPath,
                   java.net.URL war)
            throws java.io.IOException
Deploy a new web application, whose web application archive is at the specified URL, into this container with the specified context path. A context path of "" (the empty string) should be used for the root application for this container. Otherwise, the context path must start with a slash.

If this application is successfully deployed, a ContainerEvent of type DEPLOY_EVENT will be sent to all registered listeners, with the newly created Context as an argument.

Specified by:
deploy in interface Deployer
Parameters:
contextPath - The context path to which this application should be deployed (must be unique)
war - A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be deployed
Throws:
java.lang.IllegalArgumentException - if the specified context path is malformed (it must be "" or start with a slash)
java.lang.IllegalArgumentException - if the specified context path is already attached to an existing web application
java.io.IOException - if an input/output error was encountered during deployment

findDeployedApp

public Context findDeployedApp(java.lang.String contextPath)
Return the Context for the deployed application that is associated with the specified context path (if any); otherwise return null.
Specified by:
findDeployedApp in interface Deployer
Parameters:
contextPath - The context path of the requested web application

findDeployedApps

public java.lang.String[] findDeployedApps()
Return the context paths of all deployed web applications in this Container. If there are no deployed applications, a zero-length array is returned.
Specified by:
findDeployedApps in interface Deployer

undeploy

public void undeploy(java.lang.String contextPath)
              throws java.io.IOException
Undeploy an existing web application, attached to the specified context path. If this application is successfully undeployed, a ContainerEvent of type UNDEPLOY_EVENT will be sent to all registered listeners, with the undeployed Context as an argument.
Specified by:
undeploy in interface Deployer
Parameters:
contextPath - The context path of the application to be undeployed
Throws:
java.lang.IllegalArgumentException - if the specified context path is malformed (it must be "" or start with a slash)
java.lang.IllegalArgumentException - if the specified context path does not identify a currently deployed web application
java.io.IOException - if an input/output error occurs during undeployment

addDefaultMapper

protected void addDefaultMapper(java.lang.String mapperClass)
Add a default Mapper implementation if none have been configured explicitly.
Overrides:
addDefaultMapper in class ContainerBase
Parameters:
mapperClass - Java class name of the default Mapper

expand

protected java.lang.String expand(java.net.URL war)
                           throws java.io.IOException
Expand the WAR file found at the specified URL into an unpacked directory structure, and return the absolute pathname to the expanded directory.
Parameters:
war - URL of the web application archive to be expanded (must start with "jar:")
Throws:
java.lang.IllegalArgumentException - if this is not a "jar:" URL
java.io.IOException - if an input/output error was encountered during expansion

expand

protected void expand(java.io.InputStream input,
                      java.io.File docBase,
                      java.lang.String name)
               throws java.io.IOException
Expand the specified input stream into the specified directory, creating a file named from the specified relative path.
Parameters:
input - InputStream to be copied
docBase - Document base directory into which we are expanding
name - Relative pathname of the file to be created
Throws:
java.io.IOException - if an input/output error occurs

remove

protected void remove(java.io.File dir)
               throws java.io.IOException
Remove the specified directory and all of its contents.
Parameters:
dir - Directory to be removed
Throws:
java.io.IOException - if an input/output error occurs


Copyright © 2000 Apache Software Foundation. All Rights Reserved.