|
|||||||||
| Home >> All >> org >> mortbay >> jetty >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mortbay.jetty.servlet
Class WebApplicationContext

java.lang.Objectorg.mortbay.http.HttpContext
org.mortbay.jetty.servlet.ServletHttpContext
org.mortbay.jetty.servlet.WebApplicationContext
- All Implemented Interfaces:
- java.io.Externalizable, org.mortbay.http.HttpHandler, org.mortbay.util.LifeCycle, java.io.Serializable
- public class WebApplicationContext
- extends ServletHttpContext
- implements java.io.Externalizable
- extends ServletHttpContext
Standard web.xml configured HttpContext. This specialization of HttpContext uses the standardized web.xml to describe a web application and configure the handlers for the HttpContext. If a file named web-jetty.xml or jetty-web.xml is found in the WEB-INF directory it is applied to the context using the XmlConfiguration format. A single WebApplicationHandler instance is used to provide security, filter, sevlet and resource handling.
- Version:
- $Id: WebApplicationContext.java,v 1.113 2003/11/22 16:06:03 gregwilkins Exp $
| Nested Class Summary |
| Nested classes inherited from class org.mortbay.http.HttpContext |
org.mortbay.http.HttpContext.ResourceMetaData |
| Field Summary | |
private java.lang.Object |
_contextAttributeListeners
|
private java.lang.Object |
_contextListeners
|
private java.lang.String |
_defaultsDescriptor
|
private java.lang.String |
_deploymentDescriptor
|
private java.util.Map |
_errorPages
|
private boolean |
_extract
|
private FormAuthenticator |
_formAuthenticator
|
private boolean |
_ignorewebjetty
|
private java.lang.String |
_name
|
private java.util.Map |
_resourceAliases
|
private java.util.Map |
_tagLibMap
|
private java.lang.String |
_war
|
private java.util.Set |
_warnings
|
private org.mortbay.util.Resource |
_webApp
|
private WebApplicationHandler |
_webAppHandler
|
private org.mortbay.util.Resource |
_webInf
|
private static org.apache.commons.logging.Log |
log
|
| Fields inherited from class org.mortbay.jetty.servlet.ServletHttpContext |
|
| Fields inherited from class org.mortbay.http.HttpContext |
__ErrorHandler, __fileClassPathAttr, _cache, _cacheSize, _leastRecentlyUsed, _mostRecentlyUsed |
| Constructor Summary | |
WebApplicationContext()
Constructor. |
|
WebApplicationContext(java.lang.String webApp)
Constructor. |
|
| Method Summary | |
void |
addEventListener(java.util.EventListener listener)
|
java.lang.String |
getDefaultsDescriptor()
|
java.lang.String |
getDeploymentDescriptor()
|
java.lang.String |
getDisplayName()
|
(package private) java.lang.String |
getErrorPage(java.lang.String error)
get error page URI. |
boolean |
getExtractWAR()
|
org.mortbay.util.Resource |
getResource(java.lang.String uriInContext)
Get a resource from the context. |
java.lang.String |
getResourceAlias(java.lang.String alias)
|
ServletHandler |
getServletHandler()
Get the context ServletHandler. |
java.util.Map |
getTagLibMap()
Get the taglib map. |
protected org.mortbay.http.UserRealm |
getUserRealm(java.lang.String name)
|
java.lang.String |
getWAR()
|
WebApplicationHandler |
getWebApplicationHandler()
|
void |
handle(java.lang.String pathInContext,
java.lang.String pathParams,
org.mortbay.http.HttpRequest httpRequest,
org.mortbay.http.HttpResponse httpResponse)
Handler request. |
protected void |
initContextParam(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initDisplayName(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initErrorPage(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initFilter(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initFilterMapping(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initialize()
Initialize is called by the start method after the contexts classloader has been initialied, but before the defaults descriptor has been applied. |
protected void |
initialize(org.mortbay.xml.XmlParser.Node config)
|
protected void |
initListener(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initLocaleEncodingList(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initLoginConfig(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initMimeConfig(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initSecurityConstraint(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initSecurityRole(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initServlet(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initServletMapping(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initSessionConfig(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initTagLib(org.mortbay.xml.XmlParser.Node node)
|
protected void |
initWebXmlElement(java.lang.String element,
org.mortbay.xml.XmlParser.Node node)
Handle web.xml element. |
protected void |
initWelcomeFileList(org.mortbay.xml.XmlParser.Node node)
|
boolean |
isIgnoreWebJetty()
|
void |
readExternal(java.io.ObjectInput in)
This method restores an object's state by reading in the instance data for the object from the passed in stream. |
void |
removeAttribute(java.lang.String name)
|
(package private) java.lang.String |
removeErrorPage(java.lang.String error)
|
void |
removeEventListener(java.util.EventListener listener)
|
java.lang.String |
removeResourceAlias(java.lang.String alias)
|
private void |
resolveWebApp()
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set a context attribute. |
void |
setBaseResource(org.mortbay.util.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)
Set the defaults web.xml file. |
(package private) void |
setErrorPage(java.lang.String error,
java.lang.String uriInContext)
set error page URI. |
void |
setExtractWAR(boolean extract)
|
void |
setIgnoreWebJetty(boolean b)
|
void |
setPermissions(java.security.PermissionCollection permissions)
Set the permissions to be used for this context. |
void |
setResourceAlias(java.lang.String alias,
java.lang.String uri)
Set Resource Alias. |
void |
setResourceBase(java.lang.String resourceBase)
Set the Resource Base. |
void |
setWAR(java.lang.String war)
|
void |
start()
Start the Web Application. |
void |
stop()
Stop the web application. |
java.lang.String |
toString()
Convert this Object to a human-readable String. |
void |
writeExternal(java.io.ObjectOutput out)
This method is responsible for writing the instance data of an object to the passed in stream. |
| Methods inherited from class org.mortbay.jetty.servlet.ServletHttpContext |
addLocaleEncoding, addServlet, addServlet, checkSecurityConstraints, getLocaleEncoding, getServletContext, jSecurityCheck |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
log
private static org.apache.commons.logging.Log log
_deploymentDescriptor
private java.lang.String _deploymentDescriptor
_defaultsDescriptor
private java.lang.String _defaultsDescriptor
_war
private java.lang.String _war
_extract
private boolean _extract
_ignorewebjetty
private boolean _ignorewebjetty
_name
private transient java.lang.String _name
_formAuthenticator
private transient FormAuthenticator _formAuthenticator
_resourceAliases
private transient java.util.Map _resourceAliases
_webApp
private transient org.mortbay.util.Resource _webApp
_webInf
private transient org.mortbay.util.Resource _webInf
_warnings
private transient java.util.Set _warnings
_webAppHandler
private transient WebApplicationHandler _webAppHandler
_tagLibMap
private transient java.util.Map _tagLibMap
_contextListeners
private transient java.lang.Object _contextListeners
_contextAttributeListeners
private transient java.lang.Object _contextAttributeListeners
_errorPages
private transient java.util.Map _errorPages
| Constructor Detail |
WebApplicationContext
public WebApplicationContext()
- Constructor.
WebApplicationContext
public WebApplicationContext(java.lang.String webApp)
- Constructor.
| Method Detail |
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Description copied from interface:
java.io.Externalizable - This method is responsible for writing the instance data of an object
to the passed in stream. Note that this stream is not a subclass of
OutputStream, but rather is a class that implements theObjectOutputinterface. That interface provides a number of methods for writing Java data values to a stream.Not that the implementation of this method must be coordinated with the implementation of
readExternal.- Specified by:
writeExternalin interfacejava.io.Externalizable
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Description copied from interface:
java.io.Externalizable - This method restores an object's state by reading in the instance data
for the object from the passed in stream. Note that this stream is not
a subclass of
InputStream, but rather is a class that implements theObjectInputinterface. That interface provides a mechanism for reading in Java data types from a stream.Note that this method must be compatible with
writeExternal. It must read back the exact same types that were written by that method in the exact order they were written.If this method needs to read back an object instance, then the class for that object must be found and loaded. If that operation fails, then this method throws a
ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable
setWAR
public void setWAR(java.lang.String war)
getWAR
public java.lang.String getWAR()
getWebApplicationHandler
public WebApplicationHandler getWebApplicationHandler()
resolveWebApp
private void resolveWebApp()
throws java.io.IOException
getServletHandler
public ServletHandler getServletHandler()
- Get the context ServletHandler.
Conveniance method. If no ServletHandler exists, a new one is added to
the context. This derivation of the method creates a
WebApplicationHandler extension of ServletHandler.
- Overrides:
getServletHandlerin classServletHttpContext
setPermissions
public void setPermissions(java.security.PermissionCollection permissions)
- Description copied from class:
org.mortbay.http.HttpContext - Set the permissions to be used for this context.
The collection of permissions set here are used for all classes
loaded by this context. This is simpler that creating a
security policy file, as not all code sources may be statically
known.
isIgnoreWebJetty
public boolean isIgnoreWebJetty()
setIgnoreWebJetty
public void setIgnoreWebJetty(boolean b)
start
public void start()
throws java.lang.Exception
- Start the Web Application.
- Specified by:
startin interfaceorg.mortbay.util.LifeCycle
stop
public void stop()
throws java.lang.InterruptedException
- Stop the web application.
Handlers for resource, servlet, filter and security are removed
as they are recreated and configured by any subsequent call to start().
- Specified by:
stopin interfaceorg.mortbay.util.LifeCycle- Overrides:
stopin classServletHttpContext
handle
public void handle(java.lang.String pathInContext, java.lang.String pathParams, org.mortbay.http.HttpRequest httpRequest, org.mortbay.http.HttpResponse httpResponse) throws org.mortbay.http.HttpException, java.io.IOException
- Description copied from class:
org.mortbay.http.HttpContext - Handler request.
Call each HttpHandler until request is handled.
- Specified by:
handlein interfaceorg.mortbay.http.HttpHandler
addEventListener
public void addEventListener(java.util.EventListener listener) throws java.lang.IllegalArgumentException
removeEventListener
public void removeEventListener(java.util.EventListener listener)
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)
- Description copied from class:
org.mortbay.http.HttpContext - Set a context attribute.
Attributes are cleared when the context is stopped.
removeAttribute
public void removeAttribute(java.lang.String name)
getDisplayName
public java.lang.String getDisplayName()
getDeploymentDescriptor
public java.lang.String getDeploymentDescriptor()
setDefaultsDescriptor
public void setDefaultsDescriptor(java.lang.String defaults)
- Set the defaults web.xml file.
The default web.xml is used to configure all webapplications
before the WEB-INF/web.xml file is applied. By default the
org/mortbay/jetty/servlet/webdefault.xml resource from the
org.mortbay.jetty.jar is used.
getDefaultsDescriptor
public java.lang.String getDefaultsDescriptor()
setExtractWAR
public void setExtractWAR(boolean extract)
getExtractWAR
public boolean getExtractWAR()
initialize
protected void initialize()
throws java.lang.Exception
- Initialize is called by the start method after the contexts classloader
has been initialied, but before the defaults descriptor has been applied.
The default implementation does nothing.
initialize
protected void initialize(org.mortbay.xml.XmlParser.Node config)
throws java.lang.ClassNotFoundException,
javax.servlet.UnavailableException
initWebXmlElement
protected void initWebXmlElement(java.lang.String element, org.mortbay.xml.XmlParser.Node node) throws java.lang.Exception
- Handle web.xml element.
This method is called for each top level element within the
web.xml file. It may be specialized by derived
WebApplicationContexts to provide additional configuration and handling.
initDisplayName
protected void initDisplayName(org.mortbay.xml.XmlParser.Node node)
initContextParam
protected void initContextParam(org.mortbay.xml.XmlParser.Node node)
initFilter
protected void initFilter(org.mortbay.xml.XmlParser.Node node)
throws java.lang.ClassNotFoundException,
javax.servlet.UnavailableException
initFilterMapping
protected void initFilterMapping(org.mortbay.xml.XmlParser.Node node)
initServlet
protected void initServlet(org.mortbay.xml.XmlParser.Node node)
throws java.lang.ClassNotFoundException,
javax.servlet.UnavailableException,
java.io.IOException,
java.net.MalformedURLException
initServletMapping
protected void initServletMapping(org.mortbay.xml.XmlParser.Node node)
initListener
protected void initListener(org.mortbay.xml.XmlParser.Node node)
initSessionConfig
protected void initSessionConfig(org.mortbay.xml.XmlParser.Node node)
initMimeConfig
protected void initMimeConfig(org.mortbay.xml.XmlParser.Node node)
initWelcomeFileList
protected void initWelcomeFileList(org.mortbay.xml.XmlParser.Node node)
initLocaleEncodingList
protected void initLocaleEncodingList(org.mortbay.xml.XmlParser.Node node)
initErrorPage
protected void initErrorPage(org.mortbay.xml.XmlParser.Node node)
initTagLib
protected void initTagLib(org.mortbay.xml.XmlParser.Node node)
initSecurityConstraint
protected void initSecurityConstraint(org.mortbay.xml.XmlParser.Node node)
initLoginConfig
protected void initLoginConfig(org.mortbay.xml.XmlParser.Node node)
initSecurityRole
protected void initSecurityRole(org.mortbay.xml.XmlParser.Node node)
getUserRealm
protected org.mortbay.http.UserRealm getUserRealm(java.lang.String name)
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).- Overrides:
toStringin classServletHttpContext
setClassPath
public void setClassPath(java.lang.String classPath)
- Description copied from class:
org.mortbay.http.HttpContext - 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.
setResourceBase
public void setResourceBase(java.lang.String resourceBase)
- Description copied from class:
org.mortbay.http.HttpContext - 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.
setBaseResource
public void setBaseResource(org.mortbay.util.Resource baseResource)
- Description copied from class:
org.mortbay.http.HttpContext - 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.
getTagLibMap
public java.util.Map getTagLibMap()
- Get the taglib map.
setResourceAlias
public void setResourceAlias(java.lang.String alias, java.lang.String uri)
- Set Resource Alias.
Resource aliases map resource uri's within a context.
They may optionally be used by a handler when looking for
a resource.
getResourceAlias
public java.lang.String getResourceAlias(java.lang.String alias)
removeResourceAlias
public java.lang.String removeResourceAlias(java.lang.String alias)
getResource
public org.mortbay.util.Resource getResource(java.lang.String uriInContext) throws java.io.IOException
- Description copied from class:
org.mortbay.http.HttpContext - Get a resource from the context.
Cached Resources are returned if the resource fits within the LRU
cache. Directories may have CachedResources returned, but the
caller must use the CachedResource.setCachedData method to set the
formatted directory content.
setErrorPage
void setErrorPage(java.lang.String error, java.lang.String uriInContext)
- set error page URI.
getErrorPage
java.lang.String getErrorPage(java.lang.String error)
- get error page URI.
removeErrorPage
java.lang.String removeErrorPage(java.lang.String error)
|
|||||||||
| Home >> All >> org >> mortbay >> jetty >> [ servlet overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC