|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.AggregateLifeCycle
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 String[] |
__dftServerClasses
|
static String[] |
__dftSystemClasses
|
static String |
BASETEMPDIR
|
static String |
ERROR_PAGE
|
static String |
SERVER_CONFIG
|
static String |
SERVER_SRV_CLASSES
|
static String |
SERVER_SYS_CLASSES
|
static String |
TEMPDIR
|
static String |
WEB_DEFAULTS_XML
|
Fields inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
_decorators, _defaultSecurityHandlerClass, _options, _restrictedContextListeners, _securityHandler, _servletHandler, _sessionHandler, _wrapper, 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,
String webApp,
String contextPath)
|
|
WebAppContext(SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
This constructor is used in the geronimo integration. |
|
WebAppContext(String webApp,
String contextPath)
|
Method Summary | |
---|---|
void |
addEventListener(EventListener listener)
Add EventListener Conveniance method that calls setEventListeners(EventListener[]) |
void |
addOverrideDescriptor(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(String classname)
|
void |
addSystemClass(String classname)
|
void |
configure()
|
void |
destroy()
Destroy the joined Destroyable beans in the reverse order they were added. |
protected void |
doStart()
Start the managed lifecycle beans in the order they were added. |
protected void |
doStop()
Stop the joined lifecycle beans in the reverse order they were added. |
String[] |
getConfigurationClasses()
|
Configuration[] |
getConfigurations()
|
static WebAppContext |
getCurrentWebAppContext()
|
String[] |
getDefaultConfigurationClasses()
|
String |
getDefaultsDescriptor()
The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml |
String[] |
getDefaultServerClasses()
|
String[] |
getDefaultSystemClasses()
|
String |
getDescriptor()
|
String |
getExtraClasspath()
|
MetaData |
getMetaData()
|
String |
getOverrideDescriptor()
Deprecated. use getOverrideDescriptors() |
List<String> |
getOverrideDescriptors()
An override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml |
PermissionCollection |
getPermissions()
|
Resource |
getResource(String uriInContext)
|
String |
getResourceAlias(String alias)
|
Map<String,String> |
getResourceAliases()
|
String[] |
getServerClasses()
|
String[] |
getSystemClasses()
|
File |
getTempDirectory()
|
Throwable |
getUnavailableException()
Get an exception that caused the webapp to be unavailable |
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(String target)
Check the target. |
boolean |
isServerClass(String name)
Is the class a Server Class. |
boolean |
isSystemClass(String name)
Is the class a System Class. |
boolean |
isThrowUnavailableOnStartupException()
|
protected void |
loadConfigurations()
|
protected void |
loadSystemClasses()
|
void |
postConfigure()
|
void |
preConfigure()
Pre configure the web application. |
String |
removeResourceAlias(String alias)
|
void |
setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames)
|
void |
setClassLoader(ClassLoader classLoader)
|
void |
setConfigurationClasses(String[] configurations)
|
void |
setConfigurationDiscovered(boolean discovered)
Set the configuration discovery mode. |
void |
setConfigurations(Configuration[] configurations)
|
void |
setContextWhiteList(String[] contextWhiteList)
Set the context white list In certain circumstances you want may want to deny access of one webapp from another when you may not fully trust the webapp. |
void |
setCopyWebDir(boolean copy)
|
void |
setCopyWebInf(boolean copyWebInf)
|
void |
setDefaultsDescriptor(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(String descriptor)
|
void |
setDisplayName(String servletContextName)
|
void |
setDistributable(boolean distributable)
|
void |
setEventListeners(EventListener[] eventListeners)
Set the context event listeners. |
void |
setExtraClasspath(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(String overrideDescriptor)
Deprecated. use setOverrideDescriptors(List) |
void |
setOverrideDescriptors(List<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(PermissionCollection permissions)
|
void |
setResourceAlias(String alias,
String uri)
Set Resource Alias. |
void |
setResourceAliases(Map<String,String> map)
|
void |
setServer(Server server)
|
void |
setServerClasses(String[] serverClasses)
Set the server classes patterns. |
void |
setSystemClasses(String[] systemClasses)
Set the system classes patterns. |
void |
setTempDirectory(File dir)
Set temporary directory for context. |
void |
setThrowUnavailableOnStartupException(boolean throwIfStartupException)
|
void |
setWar(String war)
|
protected void |
startContext()
Finish constructing handlers and link them together. |
String |
toString()
|
Methods inherited from class org.eclipse.jetty.servlet.ServletContextHandler |
---|
addDecorator, addFilter, addFilter, addFilter, addFilter, addFilter, addFilter, addServlet, addServlet, addServlet, callContextDestroyed, callContextInitialized, getDecorators, getDefaultSecurityHandlerClass, getSecurityHandler, getServletHandler, getSessionHandler, newSecurityHandler, newServletHandler, newSessionHandler, setDecorators, setDefaultSecurityHandlerClass, setSecurityHandler, setServletHandler, setSessionHandler |
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 |
---|
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler |
---|
dumpThis, getServer |
Methods inherited from class org.eclipse.jetty.util.component.AggregateLifeCycle |
---|
addBean, addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, unmanage |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, 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 |
---|
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 String TEMPDIR
public static final String BASETEMPDIR
public static final String WEB_DEFAULTS_XML
public static final String ERROR_PAGE
public static final String SERVER_CONFIG
public static final String SERVER_SYS_CLASSES
public static final String SERVER_SRV_CLASSES
public static final String[] __dftSystemClasses
public static final String[] __dftServerClasses
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(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 setDisplayName(String servletContextName)
setDisplayName
in class ContextHandler
servletContextName
- The servletContextName to set.public Throwable getUnavailableException()
public void setResourceAlias(String alias, String uri)
alias
- uri
- public Map<String,String> getResourceAliases()
public void setResourceAliases(Map<String,String> map)
public String getResourceAlias(String alias)
public String removeResourceAlias(String alias)
public void setClassLoader(ClassLoader classLoader)
setClassLoader
in class ContextHandler
classLoader
- The classLoader to set.public Resource getResource(String uriInContext) throws MalformedURLException
getResource
in class ContextHandler
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 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.
Exception
public void configure() throws Exception
Exception
public void postConfigure() throws Exception
Exception
protected void doStart() throws Exception
AggregateLifeCycle
doStart
in class ContextHandler
Exception
HandlerWrapper.doStart()
protected void doStop() throws Exception
AggregateLifeCycle
doStop
in class ServletContextHandler
Exception
ContextHandler.doStop()
public void destroy()
AggregateLifeCycle
destroy
in interface Handler
destroy
in interface Destroyable
destroy
in class HandlerWrapper
Destroyable.destroy()
public String[] getConfigurationClasses()
public Configuration[] getConfigurations()
public String getDefaultsDescriptor()
public String getOverrideDescriptor()
getOverrideDescriptors()
public List<String> getOverrideDescriptors()
public PermissionCollection getPermissions()
getPermissions
in interface WebAppClassLoader.Context
public String[] getServerClasses()
setServerClasses(String[])
public void addServerClass(String classname)
public String[] getSystemClasses()
setSystemClasses(String[])
public void addSystemClass(String classname)
public boolean isServerClass(String name)
WebAppClassLoader.Context
isServerClass
in interface WebAppClassLoader.Context
name
- The fully qualified name of the class.
public boolean isSystemClass(String name)
WebAppClassLoader.Context
isSystemClass
in interface WebAppClassLoader.Context
name
- The fully qualified name of the class.
protected void loadSystemClasses()
public String getWar()
public Resource getWebInf() throws IOException
IOException
public boolean isDistributable()
public boolean isExtractWAR()
public boolean isCopyWebDir()
public boolean isCopyWebInf()
public boolean isParentLoaderPriority()
isParentLoaderPriority
in interface WebAppClassLoader.Context
public String[] getDefaultConfigurationClasses()
public String[] getDefaultServerClasses()
public String[] getDefaultSystemClasses()
protected void loadConfigurations() throws Exception
Exception
protected boolean isProtectedTarget(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 String toString()
toString
in class ContextHandler
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 setOverrideDescriptor(String overrideDescriptor)
setOverrideDescriptors(List)
overrideDescriptor
- The overrideDescritpor to set.public void setOverrideDescriptors(List<String> overrideDescriptors)
overrideDescriptors
- The overrideDescriptors (file or URL) to set.public void addOverrideDescriptor(String overrideDescriptor)
overrideDescriptor
- The overrideDescriptor (file or URL) to add.public String getDescriptor()
public void setDescriptor(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(EventListener[] eventListeners)
ContextHandler
setEventListeners
in class ContextHandler
eventListeners
- the event listenersServletContextListener
,
ServletContextAttributeListener
,
ServletRequestListener
,
ServletRequestAttributeListener
public void addEventListener(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(PermissionCollection permissions)
permissions
- The permissions to set.public void setContextWhiteList(String[] contextWhiteList)
contextWhiteList
- public void setServerClasses(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(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(File dir)
dir
- Writable temporary directory.public File getTempDirectory()
public void setWar(String war)
war
- The war to set as a file name or URLpublic String getExtraClasspath()
getExtraClasspath
in interface WebAppClassLoader.Context
public void setExtraClasspath(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)
public void setThrowUnavailableOnStartupException(boolean throwIfStartupException)
public boolean isThrowUnavailableOnStartupException()
protected void startContext() throws Exception
ServletContextHandler
startContext
in class ServletContextHandler
Exception
ContextHandler.startContext()
public MetaData getMetaData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |