|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle org.eclipse.jetty.server.handler.AbstractHandler org.eclipse.jetty.server.handler.AbstractHandlerContainer org.eclipse.jetty.server.handler.HandlerWrapper org.eclipse.jetty.server.handler.ScopedHandler org.eclipse.jetty.server.handler.ContextHandler org.eclipse.jetty.servlet.ServletContextHandler org.eclipse.jetty.webapp.WebAppContext
public class WebAppContext
Web Application Context Handler.
The WebAppContext handler is an extension of ContextHandler that
coordinates the construction and configuration of nested handlers:
ConstraintSecurityHandler
, SessionHandler
and ServletHandler
.
The handlers are configured by pluggable configuration classes, with
the default being WebXmlConfiguration
and
JettyWebXmlConfiguration
.
Nested Class Summary | |
---|---|
class |
WebAppContext.Context
|
Nested classes/interfaces inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
ServletContextHandler.Decorator |
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
AbstractLifeCycle.AbstractLifeCycleListener |
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
static java.lang.String[] |
__dftServerClasses
|
static java.lang.String[] |
__dftSystemClasses
|
static java.lang.String |
BASETEMPDIR
|
static java.lang.String |
ERROR_PAGE
|
static java.lang.String |
SERVER_CONFIG
|
static java.lang.String |
SERVER_SRV_CLASSES
|
static java.lang.String |
SERVER_SYS_CLASSES
|
static java.lang.String |
TEMPDIR
|
static java.lang.String |
WEB_DEFAULTS_XML
|
Fields inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
_decorators, _defaultSecurityHandlerClass, _jspConfig, _options, _restrictedContextListeners, _securityHandler, _servletHandler, _sessionHandler, NO_SECURITY, NO_SESSIONS, SECURITY, SESSIONS |
Fields inherited from class org.eclipse.jetty.server.handler.ContextHandler |
---|
_scontext, MANAGED_ATTRIBUTES |
Fields inherited from class org.eclipse.jetty.server.handler.ScopedHandler |
---|
_nextScope, _outerScope |
Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper |
---|
_handler |
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
WebAppContext()
|
|
WebAppContext(HandlerContainer parent,
java.lang.String webApp,
java.lang.String contextPath)
|
|
WebAppContext(SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
This constructor is used in the geronimo integration. |
|
WebAppContext(java.lang.String webApp,
java.lang.String contextPath)
|
|
WebAppContext(WebAppContext template)
|
Method Summary | |
---|---|
void |
addEventListener(java.util.EventListener listener)
Add EventListener Conveniance method that calls setEventListeners(EventListener[]) |
void |
addOverrideDescriptor(java.lang.String overrideDescriptor)
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml |
void |
addServerClass(java.lang.String classname)
|
void |
addSystemClass(java.lang.String classname)
|
void |
configure()
|
protected void |
doStart()
|
protected void |
doStop()
|
void |
dumpUrl()
|
java.lang.String[] |
getConfigurationClasses()
|
Configuration[] |
getConfigurations()
|
static WebAppContext |
getCurrentWebAppContext()
|
java.lang.String[] |
getDefaultConfigurationClasses()
|
java.lang.String |
getDefaultsDescriptor()
The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml |
java.lang.String |
getDescriptor()
|
java.lang.String |
getExtraClasspath()
|
MetaData |
getMetaData()
|
java.lang.String |
getOverrideDescriptor()
Deprecated. use getOverrideDescriptors() |
java.util.List<java.lang.String> |
getOverrideDescriptors()
An override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml |
java.security.PermissionCollection |
getPermissions()
|
Resource |
getResource(java.lang.String uriInContext)
|
java.lang.String |
getResourceAlias(java.lang.String alias)
|
java.util.Map |
getResourceAliases()
|
java.lang.String[] |
getServerClasses()
|
java.lang.String[] |
getSystemClasses()
|
java.io.File |
getTempDirectory()
|
java.lang.Throwable |
getUnavailableException()
Get an exception that caused the webapp to be unavailable |
java.lang.String |
getWar()
|
Resource |
getWebInf()
|
boolean |
isAllowDuplicateFragmentNames()
|
boolean |
isConfigurationDiscovered()
Is the context Automatically configured. |
boolean |
isCopyWebDir()
|
boolean |
isCopyWebInf()
|
boolean |
isDistributable()
|
boolean |
isExtractWAR()
|
boolean |
isLogUrlOnStart()
|
boolean |
isParentLoaderPriority()
|
protected boolean |
isProtectedTarget(java.lang.String target)
Check the target. |
boolean |
isServerClass(java.lang.String name)
Is the class a Server Class. |
boolean |
isSystemClass(java.lang.String name)
Is the class a System Class. |
protected void |
loadConfigurations()
|
protected void |
loadSystemClasses()
|
void |
postConfigure()
|
void |
preConfigure()
Pre configure the web application. |
java.lang.String |
removeResourceAlias(java.lang.String alias)
|
void |
setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames)
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
|
void |
setConfigurationClasses(java.lang.String[] configurations)
|
void |
setConfigurationDiscovered(boolean discovered)
Set the configuration discovery mode. |
void |
setConfigurations(Configuration[] configurations)
|
void |
setCopyWebDir(boolean copy)
|
void |
setCopyWebInf(boolean copyWebInf)
|
void |
setDefaultsDescriptor(java.lang.String defaultsDescriptor)
The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml |
void |
setDescriptor(java.lang.String descriptor)
|
void |
setDisplayName(java.lang.String servletContextName)
|
void |
setDistributable(boolean distributable)
|
void |
setEventListeners(java.util.EventListener[] eventListeners)
Set the context event listeners. |
void |
setExtraClasspath(java.lang.String extraClasspath)
|
void |
setExtractWAR(boolean extractWAR)
|
void |
setLogUrlOnStart(boolean logOnStart)
Sets whether or not the web app name and URL is logged on startup |
void |
setOverrideDescriptor(java.lang.String overrideDescriptor)
Deprecated. use setOverrideDescriptors(List) |
void |
setOverrideDescriptors(java.util.List<java.lang.String> overrideDescriptors)
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml |
void |
setParentLoaderPriority(boolean java2compliant)
|
void |
setPermissions(java.security.PermissionCollection permissions)
|
void |
setResourceAlias(java.lang.String alias,
java.lang.String uri)
Set Resource Alias. |
void |
setResourceAliases(java.util.Map map)
|
void |
setServer(Server server)
|
void |
setServerClasses(java.lang.String[] serverClasses)
Set the server classes patterns. |
void |
setSystemClasses(java.lang.String[] systemClasses)
Set the system classes patterns. |
void |
setTempDirectory(java.io.File dir)
Set temporary directory for context. |
void |
setTemplate(WebAppContext template)
Configure this WebAppContext from a shared WebAppContext as template. |
void |
setWar(java.lang.String war)
|
protected void |
startContext()
Finish constructing handlers and link them together. |
java.lang.String |
toString()
|
Methods inherited from class org.eclipse.jetty.server.handler.ScopedHandler |
---|
handle, never, nextHandle, nextScope |
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper |
---|
expandChildren, getHandler, getHandlers, getNestedHandlerByClass, setHandler |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer |
---|
dumpHandlers, expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler |
---|
destroy, dump, dump, getServer |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.jetty.webapp.WebAppClassLoader.Context |
---|
newResource |
Methods inherited from interface org.eclipse.jetty.server.Handler |
---|
destroy, getServer, handle |
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Field Detail |
---|
public static final java.lang.String TEMPDIR
public static final java.lang.String BASETEMPDIR
public static final java.lang.String WEB_DEFAULTS_XML
public static final java.lang.String ERROR_PAGE
public static final java.lang.String SERVER_CONFIG
public static final java.lang.String SERVER_SYS_CLASSES
public static final java.lang.String SERVER_SRV_CLASSES
public static final java.lang.String[] __dftSystemClasses
public static final java.lang.String[] __dftServerClasses
Constructor Detail |
---|
public WebAppContext()
public WebAppContext(WebAppContext template) throws java.io.IOException
java.io.IOException
public WebAppContext(java.lang.String webApp, java.lang.String contextPath)
contextPath
- The context pathwebApp
- The URL or filename of the webapp directory or war file.public WebAppContext(HandlerContainer parent, java.lang.String webApp, java.lang.String contextPath)
parent
- The parent HandlerContainer.contextPath
- The context pathwebApp
- The URL or filename of the webapp directory or war file.public WebAppContext(SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
sessionHandler
- SessionHandler for this web appsecurityHandler
- SecurityHandler for this web appservletHandler
- ServletHandler for this web apperrorHandler
- ErrorHandler for this web appMethod Detail |
---|
public static WebAppContext getCurrentWebAppContext()
public void setTemplate(WebAppContext template)
The MetaData is reused from the template.
template
- The template to base this webappcontext onpublic void setDisplayName(java.lang.String servletContextName)
setDisplayName
in class ContextHandler
servletContextName
- The servletContextName to set.public java.lang.Throwable getUnavailableException()
public void setResourceAlias(java.lang.String alias, java.lang.String uri)
alias
- uri
- public java.util.Map getResourceAliases()
public void setResourceAliases(java.util.Map map)
public java.lang.String getResourceAlias(java.lang.String alias)
public java.lang.String removeResourceAlias(java.lang.String alias)
public void setClassLoader(java.lang.ClassLoader classLoader)
setClassLoader
in class ContextHandler
classLoader
- The classLoader to set.public Resource getResource(java.lang.String uriInContext) throws java.net.MalformedURLException
getResource
in class ContextHandler
java.net.MalformedURLException
public boolean isConfigurationDiscovered()
public void setConfigurationDiscovered(boolean discovered)
discovered
- true if configuration discovery is enabled for automatic configuration from the contextpublic void preConfigure() throws java.lang.Exception
The method is normally called from AbstractLifeCycle.start()
. It performs
the discovery of the configurations to be applied to this context,
specifically:
Configuration
instances with a call to loadConfigurations()
.
loadSystemClasses()
loadServerClasses()
Configuration.preConfigure(WebAppContext)
method of all
Configuration instances.
java.lang.Exception
public void configure() throws java.lang.Exception
java.lang.Exception
public void postConfigure() throws java.lang.Exception
java.lang.Exception
protected void doStart() throws java.lang.Exception
doStart
in class ContextHandler
java.lang.Exception
HandlerWrapper.doStart()
public void dumpUrl()
protected void doStop() throws java.lang.Exception
doStop
in class ServletContextHandler
java.lang.Exception
ContextHandler.doStop()
public java.lang.String[] getConfigurationClasses()
public Configuration[] getConfigurations()
public java.lang.String getDefaultsDescriptor()
public java.lang.String getOverrideDescriptor()
getOverrideDescriptors()
public java.util.List<java.lang.String> getOverrideDescriptors()
public java.security.PermissionCollection getPermissions()
getPermissions
in interface WebAppClassLoader.Context
public java.lang.String[] getServerClasses()
setServerClasses(String[])
public void addServerClass(java.lang.String classname)
public java.lang.String[] getSystemClasses()
setSystemClasses(String[])
public void addSystemClass(java.lang.String classname)
public boolean isServerClass(java.lang.String name)
WebAppClassLoader.Context
isServerClass
in interface WebAppClassLoader.Context
name
- The fully qualified name of the class.
public boolean isSystemClass(java.lang.String name)
WebAppClassLoader.Context
isSystemClass
in interface WebAppClassLoader.Context
name
- The fully qualified name of the class.
protected void loadSystemClasses()
public java.lang.String getWar()
public Resource getWebInf() throws java.io.IOException
java.io.IOException
public boolean isDistributable()
public boolean isExtractWAR()
public boolean isCopyWebDir()
public boolean isCopyWebInf()
public boolean isParentLoaderPriority()
isParentLoaderPriority
in interface WebAppClassLoader.Context
public java.lang.String[] getDefaultConfigurationClasses()
protected void loadConfigurations() throws java.lang.Exception
java.lang.Exception
protected boolean isProtectedTarget(java.lang.String target)
ContextHandler
ScopedHandler.handle(String, Request, HttpServletRequest, HttpServletResponse)
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
public java.lang.String toString()
toString
in class ContextHandler
public void setConfigurationClasses(java.lang.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(java.lang.String defaultsDescriptor)
defaultsDescriptor
- The defaultsDescriptor to set.public void setOverrideDescriptor(java.lang.String overrideDescriptor)
setOverrideDescriptors(List)
overrideDescriptor
- The overrideDescritpor to set.public void setOverrideDescriptors(java.util.List<java.lang.String> overrideDescriptors)
overrideDescriptor
- The overrideDescriptors (file or URL) to set.public void addOverrideDescriptor(java.lang.String overrideDescriptor)
overrideDescriptor
- The overrideDescriptor (file or URL) to add.public java.lang.String getDescriptor()
public void setDescriptor(java.lang.String descriptor)
descriptor
- the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists.public void setDistributable(boolean distributable)
distributable
- The distributable to set.public void setEventListeners(java.util.EventListener[] eventListeners)
ContextHandler
setEventListeners
in class ContextHandler
eventListeners
- the event listenersServletContextListener
,
ServletContextAttributeListener
,
ServletRequestListener
,
ServletRequestAttributeListener
public void addEventListener(java.util.EventListener listener)
setEventListeners(EventListener[])
addEventListener
in class ContextHandler
listener
- ServletContextListener
,
ServletContextAttributeListener
,
ServletRequestListener
,
ServletRequestAttributeListener
public void setExtractWAR(boolean extractWAR)
extractWAR
- True if war files are extractedpublic void setCopyWebDir(boolean copy)
copy
- True if the webdir is copied (to allow hot replacement of jars)public void setCopyWebInf(boolean copyWebInf)
copyWebInf
- True if the web-inf lib and classes directories are copied (to allow hot replacement of jars on windows)public void setParentLoaderPriority(boolean java2compliant)
java2compliant
- The java2compliant to set.public void setPermissions(java.security.PermissionCollection permissions)
permissions
- The permissions to set.public void setServerClasses(java.lang.String[] serverClasses)
Server classes/packages are classes used to implement the server and are hidden from the context. If the context needs to load these classes, it must have its own copy of them in WEB-INF/lib or WEB-INF/classes. A class pattern is a string of one of the forms:
serverClasses
- The serverClasses to set.public void setSystemClasses(java.lang.String[] systemClasses)
System classes/packages are classes provided by the JVM and that
cannot be replaced by classes of the same name from WEB-INF,
regardless of the value of setParentLoaderPriority(boolean)
.
A class pattern is a string of one of the forms:
systemClasses
- The systemClasses to set.public void setTempDirectory(java.io.File dir)
dir
- Writable temporary directory.public java.io.File getTempDirectory()
public void setWar(java.lang.String war)
war
- The war to set as a file name or URLpublic java.lang.String getExtraClasspath()
getExtraClasspath
in interface WebAppClassLoader.Context
public void setExtraClasspath(java.lang.String extraClasspath)
extraClasspath
- Comma or semicolon separated path of filenames or URLs
pointing to directories or jar files. Directories should end
with '/'.public boolean isLogUrlOnStart()
public void setLogUrlOnStart(boolean logOnStart)
logOnStart
- whether or not the log message is createdpublic void setServer(Server server)
setServer
in interface Handler
setServer
in class ContextHandler
public boolean isAllowDuplicateFragmentNames()
public void setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames)
protected void startContext() throws java.lang.Exception
ServletContextHandler
startContext
in class ServletContextHandler
java.lang.Exception
ContextHandler.startContext()
public MetaData getMetaData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |