|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mortbay.component.AbstractLifeCycle
org.mortbay.jetty.handler.AbstractHandler
org.mortbay.jetty.handler.AbstractHandlerContainer
org.mortbay.jetty.handler.HandlerWrapper
org.mortbay.jetty.handler.ContextHandler
org.mortbay.jetty.servlet.Context
org.mortbay.jetty.webapp.WebAppContext
Web Application Context Handler.
The WebAppContext handler is an extension of ContextHandler that
coordinates the construction and configuration of nested handlers:
SecurityHandler
, SessionHandler
and ServletHandler
.
The handlers are configured by pluggable configuration classes, with
the default being WebXmlConfiguration
and
JettyWebXmlConfiguration
.
Nested Class Summary | |
class |
WebAppContext.WebAppErrorHandler
|
Nested classes inherited from class org.mortbay.jetty.handler.ContextHandler |
ContextHandler.Context |
Field Summary | |
static String |
ERROR_PAGE
|
static String |
WEB_DEFAULTS_XML
|
Fields inherited from class org.mortbay.jetty.servlet.Context |
_securityHandler, _servletHandler, _sessionHandler, NO_SECURITY, NO_SESSIONS, SECURITY, SESSIONS |
Fields inherited from class org.mortbay.jetty.handler.AbstractHandler |
_string |
Fields inherited from interface org.mortbay.jetty.Handler |
ALL, DEFAULT, ERROR, FORWARD, INCLUDE, REQUEST |
Constructor Summary | |
WebAppContext()
|
|
WebAppContext(HandlerContainer parent,
String webApp,
String contextPath)
|
|
WebAppContext(SecurityHandler securityHandler,
SessionHandler sessionHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
|
|
WebAppContext(String webApp,
String contextPath)
|
Method Summary | |
void |
addEventListener(EventListener listener)
Add EventListener Conveniance method that calls setEventListeners(EventListener[]) |
static void |
addWebApplications(HandlerContainer contexts,
String webapps,
String defaults,
boolean extract,
boolean java2CompliantClassLoader)
Add Web Applications. |
static void |
addWebApplications(HandlerContainer contexts,
String webapps,
String defaults,
String[] configurations,
boolean extract,
boolean java2CompliantClassLoader)
Add Web Applications. |
static void |
addWebApplications(Server server,
String webapps,
String defaults,
boolean extract,
boolean java2CompliantClassLoader)
Add Web Applications. |
static void |
addWebApplications(Server server,
String webapps,
String defaults,
String[] configurations,
boolean extract,
boolean java2CompliantClassLoader)
Add Web Applications. |
protected void |
doStart()
|
protected void |
doStop()
|
String[] |
getConfigurationClasses()
|
Configuration[] |
getConfigurations()
|
static WebAppContext |
getCurrentWebAppContext()
|
String |
getDefaultsDescriptor()
|
PermissionCollection |
getPermissions()
|
Resource |
getResource(String uriInContext)
|
String |
getResourceAlias(String alias)
|
Map |
getResourceAliases()
|
String[] |
getServerClasses()
|
String[] |
getSystemClasses()
|
File |
getTempDirectory()
Get a temporary directory in which to unpack the war etc etc. |
String |
getWar()
|
Resource |
getWebInf()
|
boolean |
isDistributable()
|
boolean |
isExtractWAR()
|
boolean |
isParentLoaderPriority()
|
protected boolean |
isProtectedTarget(String target)
Check the target. |
boolean |
isTempWorkDirectory()
Check if the _tmpDir itself is called "work", or if the _tmpDir is in a directory called "work". |
protected void |
loadConfigurations()
|
String |
removeResourceAlias(String alias)
|
protected void |
resolveWebApp()
Resolve Web App directory If the BaseResource has not been set, use the war resource to derive a webapp resource (expanding WAR if required). |
void |
setConfigurationClasses(String[] configurations)
|
void |
setConfigurations(Configuration[] configurations)
|
void |
setDefaultsDescriptor(String defaultsDescriptor)
|
void |
setDistributable(boolean distributable)
|
void |
setEventListeners(EventListener[] eventListeners)
|
void |
setExtractWAR(boolean extractWAR)
|
void |
setParentLoaderPriority(boolean java2compliant)
|
void |
setPermissions(PermissionCollection permissions)
|
void |
setResourceAlias(String alias,
String uri)
Set Resource Alias. |
void |
setResourceAliases(Map map)
|
void |
setSecurityHandler(SecurityHandler securityHandler)
|
void |
setServerClasses(String[] serverClasses)
|
void |
setServletHandler(ServletHandler servletHandler)
|
void |
setSessionHandler(SessionHandler sessionHandler)
|
void |
setSystemClasses(String[] systemClasses)
|
void |
setTempDirectory(File dir)
Set temporary directory for context. |
void |
setWar(String war)
|
protected void |
startContext()
|
Methods inherited from class org.mortbay.jetty.servlet.Context |
addFilter, addFilter, addFilter, addServlet, addServlet, addServlet, getSecurityHandler, getServletHandler, getSessionHandler |
Methods inherited from class org.mortbay.jetty.handler.HandlerWrapper |
addHandler, expandChildren, getHandler, setHandler |
Methods inherited from class org.mortbay.jetty.handler.AbstractHandlerContainer |
expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
Methods inherited from class org.mortbay.jetty.handler.AbstractHandler |
getServer |
Methods inherited from class org.mortbay.component.AbstractLifeCycle |
isFailed, isRunning, isStarted, isStarting, isStopping, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.mortbay.component.LifeCycle |
isFailed, isRunning, isStarted, isStarting, isStopping, start, stop |
Field Detail |
public static final String WEB_DEFAULTS_XML
public static final String ERROR_PAGE
Constructor Detail |
public WebAppContext()
public WebAppContext(String webApp, String contextPath)
contextPath
- The context pathwebApp
- The URL or filename of the webapp directory or war file.public WebAppContext(HandlerContainer parent, String webApp, String contextPath)
parent
- The parent HandlerContainer.contextPath
- The context pathwebApp
- The URL or filename of the webapp directory or war file.public WebAppContext(SecurityHandler securityHandler, SessionHandler sessionHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
Method Detail |
public static WebAppContext getCurrentWebAppContext()
public static void addWebApplications(Server server, String webapps, String defaults, boolean extract, boolean java2CompliantClassLoader) throws IOException
server
- Must not be null
webapps
- Directory file name or URL to look for auto
webapplication.defaults
- The defaults xml filename or URL which is
loaded before any in the web app. Must respect the web.dtd.
If null the default defaults file is used. If the empty string, then
no defaults file is used.extract
- If true, extract war filesjava2CompliantClassLoader
- True if java2 compliance is applied to all webapplications
IOException
public static void addWebApplications(Server server, String webapps, String defaults, String[] configurations, boolean extract, boolean java2CompliantClassLoader) throws IOException
server
- Must not be null
.webapps
- Directory file name or URL to look for auto
webapplication.defaults
- The defaults xml filename or URL which is
loaded before any in the web app. Must respect the web.dtd.
If null the default defaults file is used. If the empty string, then
no defaults file is used.configurations
- Array of classnames of Configuration
implementations to apply.extract
- If true, extract war filesjava2CompliantClassLoader
- True if java2 compliance is applied to all webapplications
IOException
IllegalAccessException
InstantiationException
public static void addWebApplications(HandlerContainer contexts, String webapps, String defaults, boolean extract, boolean java2CompliantClassLoader) throws IOException
contexts
- A HandlerContainer to which the contexts will be addedwebapps
- Directory file name or URL to look for auto
webapplication.defaults
- The defaults xml filename or URL which is
loaded before any in the web app. Must respect the web.dtd.
If null the default defaults file is used. If the empty string, then
no defaults file is used.extract
- If true, extract war filesjava2CompliantClassLoader
- True if java2 compliance is applied to all webapplications
IOException
IllegalAccessException
InstantiationException
public static void addWebApplications(HandlerContainer contexts, String webapps, String defaults, String[] configurations, boolean extract, boolean java2CompliantClassLoader) throws IOException
contexts
- A HandlerContainer to which the contexts will be addedwebapps
- Directory file name or URL to look for auto
webapplication.defaults
- The defaults xml filename or URL which is
loaded before any in the web app. Must respect the web.dtd.
If null the default defaults file is used. If the empty string, then
no defaults file is used.configurations
- Array of classnames of Configuration
implementations to apply.extract
- If true, extract war filesjava2CompliantClassLoader
- True if java2 compliance is applied to all webapplications
IOException
IllegalAccessException
InstantiationException
public void setResourceAlias(String alias, String uri)
alias
- uri
- public Map getResourceAliases()
public void setResourceAliases(Map map)
public String getResourceAlias(String alias)
public String removeResourceAlias(String alias)
public Resource getResource(String uriInContext) throws MalformedURLException
getResource
in class ContextHandler
MalformedURLException
protected void doStart() throws Exception
doStart
in class ContextHandler
Exception
protected void doStop() throws Exception
doStop
in class ContextHandler
Exception
public String[] getConfigurationClasses()
public Configuration[] getConfigurations()
public String getDefaultsDescriptor()
public PermissionCollection getPermissions()
public String[] getServerClasses()
public String[] getSystemClasses()
public File getTempDirectory()
A. Try to use an explicit directory specifically for this webapp:
B. Create a directory based on global settings. The new directory will be called "Jetty_"+host+"_"+port+"__"+context+"_"+virtualhost Work out where to create this directory:
public boolean isTempWorkDirectory()
public String getWar()
public Resource getWebInf() throws IOException
IOException
public boolean isDistributable()
public boolean isExtractWAR()
public boolean isParentLoaderPriority()
protected void loadConfigurations() throws Exception
Exception
protected boolean isProtectedTarget(String target)
ContextHandler
ContextHandler.handle(String, HttpServletRequest, HttpServletResponse, int)
when a
target within a context is determined. If the target is protected, 404 is returned.
The default implementation always returns false.
isProtectedTarget
in class ContextHandler
isProtectedTarget(String)
protected void resolveWebApp() throws IOException
IOException
public void setConfigurationClasses(String[] configurations)
configurations
- The configuration class names. If setConfigurations is not called
these classes are used to create a configurations array.public void setConfigurations(Configuration[] configurations)
configurations
- The configurations to set.public void setDefaultsDescriptor(String defaultsDescriptor)
defaultsDescriptor
- The defaultsDescriptor to set.public void setDistributable(boolean distributable)
distributable
- The distributable to set.public void setEventListeners(EventListener[] eventListeners)
setEventListeners
in class ContextHandler
public void addEventListener(EventListener listener)
setEventListeners(EventListener[])
addEventListener
in class ContextHandler
listener
- public void setExtractWAR(boolean extractWAR)
extractWAR
- The extractWAR to set.public void setParentLoaderPriority(boolean java2compliant)
java2compliant
- The java2compliant to set.public void setPermissions(PermissionCollection permissions)
permissions
- The permissions to set.public void setSecurityHandler(SecurityHandler securityHandler)
securityHandler
- The SecurityHandler
to set on this context.public void setServerClasses(String[] serverClasses)
serverClasses
- The serverClasses to set.public void setServletHandler(ServletHandler servletHandler)
servletHandler
- The servletHandler to set.public void setSessionHandler(SessionHandler sessionHandler)
sessionHandler
- The sessionHandler to set.public void setSystemClasses(String[] systemClasses)
systemClasses
- The systemClasses to set.public void setTempDirectory(File dir)
dir
- Writable temporary directory.public void setWar(String war)
war
- The war to set as a file name or URLprotected void startContext() throws Exception
startContext
in class ContextHandler
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |