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.
configureClassPath
protected void configureClassPath()
throws Exception
configureDefaults
protected void configureDefaults()
throws Exception
configureWebApp
protected void configureWebApp()
throws Exception
destroy
public void destroy()
Destroy a context.
Destroy a context and remove it from the HttpServer. The
HttpContext must be stopped before it can be destroyed.
- destroy in interface ServletHttpContext
doStart
protected void doStart()
throws Exception
Start the Web Application.
- doStart in interface HttpContext
doStop
protected void doStop()
throws Exception
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().
- doStop in interface ServletHttpContext
getConfigurationClassNames
public String[] getConfigurationClassNames()
getDefaultsDescriptor
public String getDefaultsDescriptor()
getDisplayName
public String getDisplayName()
getErrorPage
public String getErrorPage(String error)
get error page URI.
error
- A string representing an error code or a
exception classname
getExtractWAR
public boolean getExtractWAR()
getResourceAlias
public String getResourceAlias(String alias)
getResourceAliases
public Map getResourceAliases()
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.
- getServletHandler in interface ServletHttpContext
getUserRealm
protected UserRealm getUserRealm(String name)
getWAR
public String getWAR()
getWebInf
public Resource getWebInf()
throws IOException
handle
public void handle(String pathInContext,
String pathParams,
HttpRequest httpRequest,
HttpResponse httpResponse)
throws HttpException,
IOException
Handler request.
Call each HttpHandler until request is handled.
- handle in interface HttpHandler
- handle in interface HttpContext
pathInContext
- Path in contextpathParams
- Path parameters such as encoded Session ID
initialize
protected void initialize()
throws 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.
isDistributable
public boolean isDistributable()
isIgnoreWebJetty
public boolean isIgnoreWebJetty()
readExternal
public void readExternal(java.io.ObjectInput in)
throws IOException,
ClassNotFoundException
removeErrorPage
public String removeErrorPage(String error)
removeResourceAlias
public String removeResourceAlias(String alias)
setConfigurationClassNames
public void setConfigurationClassNames(String[] configurationClassNames)
setDefaultsDescriptor
public void setDefaultsDescriptor(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.
defaults
- File, Resource, URL or null.
setDisplayName
public void setDisplayName(String name)
setDistributable
public void setDistributable(boolean distributable)
setErrorPage
public void setErrorPage(String error,
String uriInContext)
set error page URI.
error
- A string representing an error code or a
exception classnameuriInContext
-
setExtractWAR
public void setExtractWAR(boolean extract)
extract
- If true, a WAR is extracted to a temporary
directory before being deployed.
setIgnoreWebJetty
public void setIgnoreWebJetty(boolean b)
b
- If TRUE, web-jetty.xml and jetty-web.xml configuration
files are ignored.
setPermissions
public void setPermissions(PermissionCollection permissions)
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.
- setPermissions in interface HttpContext
setResourceAlias
public void setResourceAlias(String alias,
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.
setWAR
public void setWAR(String war)
war
- Filename or URL of the web application directory or WAR file.
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws IOException