org.mortbay.jetty.servlet
Class WebApplicationContext

java.lang.Object
  |
  +--org.mortbay.http.HandlerContext
        |
        +--org.mortbay.jetty.servlet.ServletHandlerContext
              |
              +--org.mortbay.jetty.servlet.WebApplicationContext
All Implemented Interfaces:
LifeCycle

public class WebApplicationContext
extends ServletHandlerContext

Standard web.xml configured HandlerContext. This specialization of HandlerContext uses the standardized web.xml to describe a web application and configure the handlers for the HandlerContext.

It creates and/or configures the following Handlers:

Version:
$Id: WebApplicationContext.java,v 1.5 2001/11/05 04:56:49 gregwilkins Exp $
Author:
Greg Wilkins (gregw)

Constructor Summary
WebApplicationContext(HttpServer httpServer, java.lang.String contextPathSpec)
          Constructor.
WebApplicationContext(HttpServer httpServer, java.lang.String contextPathSpec, java.lang.String webApp, java.lang.String defaults, boolean extractWar)
          Constructor.
 
Method Summary
 java.lang.String getDefaultsDescriptor()
           
 java.lang.String getDeploymentDescriptor()
           
 java.lang.String getDisplayName()
           
 boolean getExtractWAR()
           
 java.util.Map getTagLibMap()
          Get the taglib map.
 java.lang.String getWAR()
           
 XmlParser getXmlParser()
           
 void initialize(java.lang.String webApp, java.lang.String defaults, boolean extractWar)
          Initialize.
 void setBaseResource(Resource baseResource)
          Set the base resource.
 void setClassPath(java.lang.String classPath)
          Sets the class path for the context.
 void setDefaultsDescriptor(java.lang.String defaults)
           
 void setExtractWAR(boolean extract)
           
 void setResourceBase(java.lang.String resourceBase)
          Set the Resource Base.
 void setWAR(java.lang.String war)
           
 void start()
          Start the Web Application.
 java.lang.String toString()
           
 
Methods inherited from class org.mortbay.jetty.servlet.ServletHandlerContext
addServlet, addServlet, getDynamicServletPathSpec, getServletHandler, setDynamicServletPathSpec
 
Methods inherited from class org.mortbay.http.HandlerContext
addAuthConstraint, addHandler, addHandler, addPermission, addSecurityConstraint, destroy, getAttribute, getAttributeNames, getBaseResource, getClassLoader, getClassPath, getContextPath, getEncodingByMimeType, getEncodingMap, getErrorPage, getHandler, getHandler, getHandlerIndex, getHandlers, getHandlerSize, getHosts, getHttpServer, getHttpServerAccess, getInitParameter, getInitParameterNames, getLogSink, getMimeByExtension, getMimeMap, getPermissions, getRealm, getRequests, getResource, getResourceAlias, getResourceBase, getResourceHandler, getResponses1xx, getResponses2xx, getResponses3xx, getResponses4xx, getResponses5xx, getSecurityHandler, getStatsOn, handle, handle, isDestroyed, isRedirectNullPath, isServingResources, isStarted, registerHost, removeAttribute, removeErrorPage, removeHandler, removeHandler, removeResourceAlias, setAttribute, setClassLoader, setClassPaths, setClassPaths, setEncodingMap, setErrorPage, setHttpServerAccess, setInitParameter, setLogSink, setMimeMap, setMimeMapping, setPermissions, setRealm, setRealm, setRedirectNullPath, setResourceAlias, setServingResources, setStatsOn, setTypeEncoding, statsReset, stop, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebApplicationContext

public WebApplicationContext(HttpServer httpServer,
                             java.lang.String contextPathSpec)
Constructor. This constructor should be used if the XmlParser needs to be customized before initialization of the web application. The XmlParser can be customized with the addition of observers for specific tag types (eg ejb-ref).
Parameters:
httpServer - The HttpServer for this context
contextPathSpec - The context path spec. Which must be of the form / or /path/*

WebApplicationContext

public WebApplicationContext(HttpServer httpServer,
                             java.lang.String contextPathSpec,
                             java.lang.String webApp,
                             java.lang.String defaults,
                             boolean extractWar)
                      throws java.io.IOException
Constructor.
Parameters:
httpServer - The HttpServer for this context
contextPathSpec - The context path spec. Which must be of the form / or /path/*
webApp - The Web application directory or WAR file.
defaults - The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
extractWar - If true, WAR files are extracted to a temporary directory.
Throws:
java.io.IOException -  
Method Detail

initialize

public void initialize(java.lang.String webApp,
                       java.lang.String defaults,
                       boolean extractWar)
                throws java.io.IOException
Initialize. This method can be called directly if the null constructor was used. This style of construction allows the XmlParser to be configured with observers before initialization.
Parameters:
webApp - The Web application directory or WAR file.
defaults - The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. Normally this is passed the file $JETTY_HOME/etc/webdefault.xml
extractWar - If true, WAR files are extracted to a temporary directory.
Throws:
java.io.IOException -  

start

public void start()
           throws java.lang.Exception
Start the Web Application.
Overrides:
start in class HandlerContext
Throws:
java.io.IOException -  

getXmlParser

public XmlParser getXmlParser()

getDisplayName

public java.lang.String getDisplayName()

getDeploymentDescriptor

public java.lang.String getDeploymentDescriptor()

setDefaultsDescriptor

public void setDefaultsDescriptor(java.lang.String defaults)

getDefaultsDescriptor

public java.lang.String getDefaultsDescriptor()

setWAR

public void setWAR(java.lang.String war)

getWAR

public java.lang.String getWAR()

setExtractWAR

public void setExtractWAR(boolean extract)

getExtractWAR

public boolean getExtractWAR()

toString

public java.lang.String toString()
Overrides:
toString in class ServletHandlerContext

setClassPath

public void setClassPath(java.lang.String classPath)
Description copied from class: HandlerContext
Sets the class path for the context. A class path is only required for a context if it uses classes that are not in the system class path.
Overrides:
setClassPath in class HandlerContext
Following copied from class: org.mortbay.http.HandlerContext
Parameters:
fileBase -  

setResourceBase

public void setResourceBase(java.lang.String resourceBase)
Description copied from class: HandlerContext
Set the Resource Base. The base resource is the Resource to use as a relative base for all context resources. The ResourceBase attribute is a string version of the baseResource. If a relative file is passed, it is converted to a file URL based on the current working directory.
Overrides:
setResourceBase in class HandlerContext
Following copied from class: org.mortbay.http.HandlerContext
Parameters:
resourceBase - A URL prefix or directory name.

setBaseResource

public void setBaseResource(Resource baseResource)
Description copied from class: HandlerContext
Set the base resource. The base resource is the Resource to use as a relative base for all context resources. The ResourceBase attribute is a string version of the baseResource.
Overrides:
setBaseResource in class HandlerContext
Following copied from class: org.mortbay.http.HandlerContext
Parameters:
base - The resourceBase as a Resource instance

getTagLibMap

public java.util.Map getTagLibMap()
Get the taglib map.
Returns:
A map of uri to location for tag libraries.


Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.