Class WebAppContext
- All Implemented Interfaces:
Supplier<Handler>, Handler, HandlerContainer, WebAppClassLoader.Context, Deployable, Attributes, ClassVisibilityChecker, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
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
Nested ClassesNested classes/interfaces inherited from class ServletContextHandler
ServletContextHandler.Initializer, ServletContextHandler.JspConfig, ServletContextHandler.JspPropertyGroup, ServletContextHandler.ServletAPIContext, ServletContextHandler.ServletContainerInitializerCaller, ServletContextHandler.ServletContainerInitializerStarter, ServletContextHandler.TagLibNested classes/interfaces inherited from class ContextHandler
ContextHandler.APIContext, ContextHandler.ContextScopeListener, ContextHandler.ContextStatus, ContextHandler.CoreContextHandler, ContextHandler.CoreContextRequestNested classes/interfaces inherited from class AbstractHandler
AbstractHandler.ErrorDispatchHandlerNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.WrapperNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface LifeCycle
LifeCycle.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClassMatcherDeprecated, for removal: This API element is subject to removal in a future version.static final ClassMatcherDeprecated, for removal: This API element is subject to removal in a future version.static final Stringstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.useWebAppClassLoading.HIDDEN_CLASSES_ATTRIBUTEinstead.static final StringDeprecated, for removal: This API element is subject to removal in a future version.useWebAppClassLoading.PROTECTED_CLASSES_ATTRIBUTEinstead.static final StringFields inherited from class ServletContextHandler
_defaultSecurityHandlerClass, _jspConfig, _objFactory, _options, _securityHandler, _servletHandler, _sessionHandler, NO_SECURITY, NO_SESSIONS, SECURITY, SESSIONSFields inherited from class ContextHandler
_apiContext, _contextStatus, DEFAULT_LISTENER_TYPE_INDEX, DEFAULT_MAX_FORM_CONTENT_SIZE, DEFAULT_MAX_FORM_KEYS, ENVIRONMENT, EXTENDED_LISTENER_TYPE_INDEX, MAX_FORM_CONTENT_SIZE_KEY, MAX_FORM_KEYS_KEY, SERVLET_LISTENER_TYPES, SERVLET_MAJOR_VERSION, SERVLET_MINOR_VERSIONFields inherited from class ScopedHandler
_nextScope, _outerScopeFields inherited from class HandlerWrapper
_handlerFields inherited from interface Attributes
NULLFields inherited from interface Deployable
ATTRIBUTE_PREFIX, CONFIGURATION_CLASSES, CONTAINER_SCAN_JARS, CONTEXT_HANDLER_CLASS, CONTEXT_PATH, DEFAULTS_DESCRIPTOR, EE_ENVIRONMENT_NAME_PATTERN, ENVIRONMENT, ENVIRONMENT_COMPARATOR, ENVIRONMENT_XML, EXTRACT_WARS, PARENT_LOADER_PRIORITY, SCI_EXCLUSION_PATTERN, SCI_ORDER, TEMP_DIR, WAR, WEBINF_SCAN_JARS -
Constructor Summary
ConstructorsConstructorDescriptionWebAppContext(String webApp, String contextPath) WebAppContext(SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler) This constructor is used in the geronimo integration.WebAppContext(Handler.Container parent, String webApp, String contextPath) WebAppContext(Handler.Container parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler, int options) This constructor is used in the geronimo integration.WebAppContext(Handler.Container parent, Resource webApp, String contextPath) WebAppContext(Resource webApp, String contextPath) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguration(Configuration... configuration) voidaddOverrideDescriptor(String overrideDescriptor) The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xmlstatic voidaddServerClasses(Attributes attributes, String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.voidaddServerClassMatcher(ClassMatcher serverClasses) Add a ClassMatcher for server classes by combining with any existing matcher.static voidaddSystemClasses(Attributes attributes, String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.voidaddSystemClassMatcher(ClassMatcher systemClasses) Add a ClassMatcher for system classes by combining with any existing matcher.booleanprotected ClassLoaderconfigureClassLoader(ClassLoader loader) Configure the contextClassLoader, potentially wrapping it.voiddestroy()Destroys the managed Destroyable beans in the reverse order they were added.protected voiddoStart()Starts the managed lifecycle beans in the order they were added.voiddump(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected String<T> TgetConfiguration(Class<? extends T> configClass) String[]static WebAppContextThe default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xmlThe override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xmlAn override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xmlgetResource(String pathInContext) Attempt to get a Resource from the Context.getResourceAlias(String path) String[]String[]Get an exception that caused the webapp to be unavailablegetWar()voidinitializeDefaults(Map<String, String> properties) booleanbooleanIs the context Automatically configured.booleanbooleanbooleanbooleanbooleanbooleanisHiddenClass(Class<?> clazz) Is the class a Hidden (Server) Class.booleanbooleanbooleanbooleanisProtectedClass(Class<?> clazz) Is the class a Protected (System) Class.booleanisServerClass(Class<?> clazz) Is the class a Server Class.booleanisServerResource(String name, URL url) booleanisSystemClass(Class<?> clazz) Is the class a System Class.booleanisSystemResource(String name, URL url) booleanprotected voidprotected voidprotected ConfigurationsvoidvoidPre configure the web application.voidremoveConfiguration(Class<? extends Configuration>... configurations) voidremoveConfiguration(Configuration... configurations) booleanremoveEventListener(EventListener listener) Remove an event listener.removeResourceAlias(String alias) voidsetAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames) voidsetClassLoader(ClassLoader classLoader) voidsetConfigurationClasses(String[] configurations) voidsetConfigurationClasses(List<String> configurations) voidsetConfigurationDiscovered(boolean discovered) Set the configuration discovery mode.voidsetConfigurations(Configuration[] configurations) voidsetContextPath(String contextPath) voidsetContextWhiteList(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.voidsetCopyWebDir(boolean copy) voidsetCopyWebInf(boolean copyWebInf) voidsetDefaultContextPath(String contextPath) voidsetDefaultsDescriptor(String defaultsDescriptor) The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xmlvoidsetDescriptor(String descriptor) Set the web.xml descriptor to use.voidsetDisplayName(String displayName) voidsetDistributable(boolean distributable) voidsetExtraClasspath(String extraClasspath) Set the Extra ClassPath via delimited String.voidsetExtraClasspath(List<Resource> extraClasspath) voidsetExtractWAR(boolean extractWAR) voidsetLogUrlOnStart(boolean logOnStart) Sets whether or not the web app name and URL is logged on startupvoidsetOverrideDescriptor(String overrideDescriptor) The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xmlvoidsetOverrideDescriptors(List<String> overrideDescriptors) The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xmlvoidsetParentLoaderPriority(boolean java2compliant) voidsetPermissions(PermissionCollection permissions) voidsetPersistTempDirectory(boolean persist) If true the temp directory for this webapp will be kept when the webapp stops.voidsetResourceAlias(String alias, String uri) Set Resource Alias.voidsetResourceAliases(Map<String, String> map) voidvoidsetServerClassMatcher(ClassMatcher serverClasses) Set the server classes patterns.setServletSecurity(javax.servlet.ServletRegistration.Dynamic registration, javax.servlet.ServletSecurityElement servletSecurityElement) Delegate for ServletRegistration.Dynamic.setServletSecurity methodvoidsetSystemClassMatcher(ClassMatcher systemClasses) Set the system classes patterns.voidsetTempDirectory(File dir) Set temporary directory for context.voidsetThrowUnavailableOnStartupException(boolean throwIfStartupException) voidSet the war of the webapp.voidsetWarResource(Resource war) Set the war of the webapp as aResource.protected voidFinish constructing handlers and link them together.protected voidContinue thestartContext()before callingsuper.startContext().protected voidprotected voidContinue thestopContext()before callingsuper.stopContext().toString()Methods inherited from class ServletContextHandler
addEventListener, addFilter, addFilter, addFilter, addRoles, addServlet, addServlet, addServlet, addServletContainerInitializer, addServletContainerInitializer, addServletContainerInitializer, callContextDestroyed, callContextInitialized, doStop, dynamicHolderAdded, getDefaultSecurityHandlerClass, getObjectFactory, getSecurityHandler, getServletContextHandler, getServletContextHandler, getServletHandler, getSessionHandler, insertHandler, newSecurityHandler, newServletHandler, newSessionHandler, setDefaultSecurityHandlerClass, setHandler, setSecurityHandler, setServletHandler, setSessionHandlerMethods inherited from class ContextHandler
addAliasCheck, addLocaleEncoding, addProgrammaticListener, addVirtualHosts, checkAlias, clearAliasChecks, clearAttributes, contextDestroyed, contextInitialized, doHandle, doScope, doStartInContext, doStopInContext, enterScope, exitScope, get, getAliasChecks, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributeNameSet, getAttributes, getBaseResource, getClassLoader, getClassPath, getContextHandler, getContextPath, getContextPathEncoded, getCoreContextHandler, getCurrentContext, getCurrentContextHandler, getDefaultRequestCharacterEncoding, getDefaultResponseCharacterEncoding, getDisplayName, getErrorHandler, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLocaleEncoding, getLocaleEncodings, getLogger, getMaxFormContentSize, getMaxFormKeys, getMimeTypes, getProtectedTargets, getRequestContextPath, getResourceBase, getResourcePaths, getServletContext, getServletContext, getVirtualHosts, getWelcomeFiles, handle, handle, handle, handleAsync, handleCrossContextAsync, handleOptions, insertHandler, isAvailable, isCompactPath, isCrossContextDispatchSupported, isDurableListener, isProgrammaticListener, isProtectedTarget, isUsingSecurityManager, loadClass, newResource, newResource, newResource, removeAttribute, removeVirtualHosts, requestDestroyed, requestInitialized, setAliasChecks, setAllowNullPathInfo, setAttribute, setAttributes, setAvailable, setBaseResource, setBaseResourceAsPath, setBaseResourceAsString, setCompactPath, setCrossContextDispatchSupported, setDefaultRequestCharacterEncoding, setDefaultResponseCharacterEncoding, setErrorHandler, setInitParameter, setLogger, setMaxFormContentSize, setMaxFormKeys, setProtectedTargets, setResourceBase, setUsingSecurityManager, setVirtualHosts, setWelcomeFilesMethods inherited from class ScopedHandler
handle, nextHandle, nextScopeMethods inherited from class HandlerWrapper
expandChildren, getHandler, getHandlers, getTail, setAsParentMethods inherited from class AbstractHandlerContainer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClassMethods inherited from class AbstractHandler
doError, getServerMethods inherited from class ContainerLifeCycle
addBean, addBean, addManaged, contains, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Attributes
asAttributeMap, equals, hashCodeMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stopMethods inherited from interface WebAppClassLoader.Context
newResource
-
Field Details
-
WEB_DEFAULTS_XML
- See Also:
-
ERROR_PAGE
- See Also:
-
SERVER_SYS_CLASSES
Deprecated, for removal: This API element is subject to removal in a future version.useWebAppClassLoading.PROTECTED_CLASSES_ATTRIBUTEinstead.- See Also:
-
SERVER_SRV_CLASSES
Deprecated, for removal: This API element is subject to removal in a future version.useWebAppClassLoading.HIDDEN_CLASSES_ATTRIBUTEinstead.- See Also:
-
__dftSystemClasses
Deprecated, for removal: This API element is subject to removal in a future version. -
__dftServerClasses
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
WebAppContext
public WebAppContext() -
WebAppContext
-
WebAppContext
-
WebAppContext
- Parameters:
parent- The parent HandlerContainer.webApp- The URL or filename of the webapp directory or war file.contextPath- The context path
-
WebAppContext
- Parameters:
parent- The parent HandlerContainer.webApp- The webapp directory or war file.contextPath- The context path
-
WebAppContext
public WebAppContext(SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler) This constructor is used in the geronimo integration.- Parameters:
sessionHandler- SessionHandler for this web appsecurityHandler- SecurityHandler for this web appservletHandler- ServletHandler for this web apperrorHandler- ErrorHandler for this web app
-
WebAppContext
public WebAppContext(Handler.Container parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler, int options) This constructor is used in the geronimo integration.- Parameters:
parent- the parent handlercontextPath- the context pathsessionHandler- SessionHandler for this web appsecurityHandler- SecurityHandler for this web appservletHandler- ServletHandler for this web apperrorHandler- ErrorHandler for this web appoptions- the options (ServletContextHandler.SESSIONSand/orServletContextHandler.SECURITY)
-
-
Method Details
-
getCurrentWebAppContext
-
initializeDefaults
- Specified by:
initializeDefaultsin interfaceDeployable
-
isContextPathDefault
public boolean isContextPathDefault() -
setContextPath
- Overrides:
setContextPathin classContextHandler- Parameters:
contextPath- The _contextPath to set.
-
setDefaultContextPath
-
setDisplayName
- Overrides:
setDisplayNamein classContextHandler- Parameters:
displayName- The servletContextName to set.
-
setResourceAlias
-
getResourceAliases
-
setResourceAliases
-
getResourceAlias
-
removeResourceAlias
-
setClassLoader
- Overrides:
setClassLoaderin classContextHandler- Parameters:
classLoader- The classLoader to set.
-
getResourceFactory
-
getResource
Description copied from class:ContextHandlerAttempt to get a Resource from the Context.- Overrides:
getResourcein classContextHandler- Parameters:
pathInContext- the path within the base resource to attempt to get- Returns:
- the resource, or null if not available.
- Throws:
MalformedURLException- if unable to form a Resource from the provided path
-
isConfigurationDiscovered
public boolean isConfigurationDiscovered()Is the context Automatically configured.- Returns:
- true if configuration discovery.
-
setConfigurationDiscovered
public void setConfigurationDiscovered(boolean discovered) Set the configuration discovery mode. If configuration discovery is set to true, then the JSR315 servlet 3.0 discovered configuration features are enabled. These are:- Web Fragments
- META-INF/resource directories
- Parameters:
discovered- true if configuration discovery is enabled for automatic configuration from the context
-
preConfigure
Pre configure the web application.The method is normally called from
AbstractLifeCycle.start(). It performs the discovery of the configurations to be applied to this context, specifically:- Instantiate the
Configurationinstances with a call toloadConfigurations(). - Instantiates a classloader (if one is not already set)
- Calls the
Configuration.preConfigure(WebAppContext)method of all Configuration instances.
- Throws:
Exception- if unable to pre configure
- Instantiate the
-
configureClassLoader
Configure the contextClassLoader, potentially wrapping it.- Parameters:
loader- The loader initially set on this context bysetClassLoader(ClassLoader)- Returns:
- Either the configured loader, or a new
ClassLoaderthat uses the loader. - Throws:
IOException
-
configure
-
postConfigure
-
doStart
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classServletContextHandler- Throws:
Exception- If there was a problem starting. Will cause a transition to FAILED state
-
destroy
public void destroy()Description copied from class:ContainerLifeCycleDestroys the managed Destroyable beans in the reverse order they were added.- Specified by:
destroyin interfaceDestroyable- Specified by:
destroyin interfaceHandler- Overrides:
destroyin classHandlerWrapper
-
getConfigurationClasses
@ManagedAttribute(value="configuration classes used to configure webapp", readonly=true) public String[] getConfigurationClasses()- Returns:
- Returns the configurations.
-
getConfigurations
- Returns:
- Returns the configurations.
-
getDefaultsDescriptor
@ManagedAttribute(value="default web.xml deascriptor applied before standard web.xml", readonly=true) public String getDefaultsDescriptor()The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml- Returns:
- Returns the defaultsDescriptor.
-
getOverrideDescriptor
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml- Returns:
- Returns the Override Descriptor.
-
getOverrideDescriptors
@ManagedAttribute(value="web.xml deascriptors applied after standard web.xml", readonly=true) public 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- Returns:
- Returns the Override Descriptor list
-
getPermissions
- Specified by:
getPermissionsin interfaceWebAppClassLoader.Context- Returns:
- Returns the permissions.
-
setServerClassMatcher
Set the server classes patterns.These classes/packages are 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.
- Parameters:
serverClasses- the server classes pattern
-
setSystemClassMatcher
Set the system classes patterns.These classes/packages are provided by the JVM and cannot be replaced by classes of the same name from WEB-INF, regardless of the value of
setParentLoaderPriority(boolean).- Parameters:
systemClasses- the system classes pattern
-
addServerClassMatcher
Add a ClassMatcher for server classes by combining with any existing matcher.- Parameters:
serverClasses- The class matcher of patterns to add to the server ClassMatcher
-
addSystemClassMatcher
Add a ClassMatcher for system classes by combining with any existing matcher.- Parameters:
systemClasses- The class matcher of patterns to add to the system ClassMatcher
-
getSystemClassMatcher
- Returns:
- The ClassMatcher used to match System (protected) classes
-
getServerClassMatcher
- Returns:
- The ClassMatcher used to match Server (hidden) classes
-
getSystemClasses
@ManagedAttribute(value="classes and packages protected by context classloader", readonly=true) public String[] getSystemClasses() -
getServerClasses
@ManagedAttribute(value="classes and packages hidden by the context classloader", readonly=true) public String[] getServerClasses() -
isHiddenClass
Description copied from interface:ClassVisibilityCheckerIs the class a Hidden (Server) Class. A Server class is a class that is part of the implementation of the server and is NOT visible to a web application. The web application may provide its own implementation of the class, to be loaded from WEB-INF/lib or WEB-INF/classes- Specified by:
isHiddenClassin interfaceClassVisibilityChecker- Parameters:
clazz- The fully qualified name of the class.- Returns:
- True if the class is a server class.
-
isProtectedClass
Description copied from interface:ClassVisibilityCheckerIs the class a Protected (System) Class. A System class is a class that is visible to a web application, but that cannot be overridden by the contents of WEB-INF/lib or WEB-INF/classes- Specified by:
isProtectedClassin interfaceClassVisibilityChecker- Parameters:
clazz- The fully qualified name of the class.- Returns:
- True if the class is a system class.
-
isServerClass
Description copied from interface:ClassVisibilityCheckerIs the class a Server Class. A Server class is a class that is part of the implementation of the server and is NOT visible to a web application. The web application may provide its own implementation of the class, to be loaded from WEB-INF/lib or WEB-INF/classes- Specified by:
isServerClassin interfaceClassVisibilityChecker- Parameters:
clazz- The fully qualified name of the class.- Returns:
- True if the class is a server class.
-
isSystemClass
Description copied from interface:ClassVisibilityCheckerIs the class a System Class. A System class is a class that is visible to a web application, but that cannot be overridden by the contents of WEB-INF/lib or WEB-INF/classes- Specified by:
isSystemClassin interfaceClassVisibilityChecker- Parameters:
clazz- The fully qualified name of the class.- Returns:
- True if the class is a system class.
-
isServerResource
- Specified by:
isServerResourcein interfaceWebAppClassLoader.Context
-
isSystemResource
- Specified by:
isSystemResourcein interfaceWebAppClassLoader.Context
-
setServer
- Specified by:
setServerin interfaceHandler- Overrides:
setServerin classContextHandler
-
getWar
- Returns:
- Returns the war as a file or URL string (Resource).
The war may be different to the @link
ContextHandler.getResourceBase()if the war has been expanded and/or copied.
-
getWebInf
- Throws:
IOException
-
isDistributable
- Returns:
- Returns the distributable.
-
isExtractWAR
- Returns:
- Returns the extractWAR.
-
isCopyWebDir
@ManagedAttribute(value="webdir copied on deploy (allows hot replacement on windows)", readonly=true) public boolean isCopyWebDir()- Returns:
- True if the webdir is copied (to allow hot replacement of jars on windows)
-
isCopyWebInf
public boolean isCopyWebInf()- Returns:
- True if the web-inf lib and classes directories are copied (to allow hot replacement of jars on windows)
-
isParentLoaderPriority
@ManagedAttribute(value="parent classloader given priority", readonly=true) public boolean isParentLoaderPriority()- Specified by:
isParentLoaderPriorityin interfaceWebAppClassLoader.Context- Returns:
- True if the classloader should delegate first to the parent classloader (standard java behaviour) or false if the classloader should first try to load from WEB-INF/lib or WEB-INF/classes (servlet spec recommendation). Default is false or can be set by the system property org.eclipse.jetty.server.webapp.parentLoaderPriority
-
loadConfigurations
protected void loadConfigurations() -
newConfigurations
-
toString
- Overrides:
toStringin classContextHandler
-
dump
Description copied from interface:DumpableDump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dumpin interfaceDumpable- Overrides:
dumpin classContextHandler- Parameters:
out- The appendable to dump toindent- The indent to apply after any new lines.- Throws:
IOException- if unable to write to Appendable
-
setConfigurationClasses
- Parameters:
configurations- The configuration class names. If setConfigurations is not called these classes are used to create a configurations array.
-
setConfigurationClasses
-
setConfigurations
- Parameters:
configurations- The configurations to set.
-
addConfiguration
-
getConfiguration
-
removeConfiguration
-
removeConfiguration
-
setDefaultsDescriptor
The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml- Parameters:
defaultsDescriptor- The defaultsDescriptor to set.
-
setOverrideDescriptor
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml- Parameters:
overrideDescriptor- The overrideDescritpor to set.
-
setOverrideDescriptors
-
addOverrideDescriptor
The override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml- Parameters:
overrideDescriptor- The overrideDescriptor (file or URL) to add.
-
getDescriptor
- Returns:
- the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists.
-
setDescriptor
Set the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists..- Parameters:
descriptor- the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists.
-
setDistributable
public void setDistributable(boolean distributable) - Parameters:
distributable- The distributable to set.
-
removeEventListener
Description copied from interface:ContainerRemove an event listener.- Specified by:
removeEventListenerin interfaceContainer- Specified by:
removeEventListenerin interfaceLifeCycle- Overrides:
removeEventListenerin classContextHandler- Parameters:
listener- the listener to remove- Returns:
- true if the listener was removed
- See Also:
-
setExtractWAR
public void setExtractWAR(boolean extractWAR) - Parameters:
extractWAR- True if war files are extracted
-
setCopyWebDir
public void setCopyWebDir(boolean copy) - Parameters:
copy- True if the webdir is copied (to allow hot replacement of jars)
-
setCopyWebInf
public void setCopyWebInf(boolean copyWebInf) - Parameters:
copyWebInf- True if the web-inf lib and classes directories are copied (to allow hot replacement of jars on windows)
-
setParentLoaderPriority
public void setParentLoaderPriority(boolean java2compliant) - Parameters:
java2compliant- True if the classloader should delegate first to the parent classloader (standard java behaviour) or false if the classloader should first try to load from WEB-INF/lib or WEB-INF/classes (servlet spec recommendation). Default is false or can be set by the system property org.eclipse.jetty.server.webapp.parentLoaderPriority
-
setPermissions
- Parameters:
permissions- The permissions to set.
-
setContextWhiteList
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. Setting this white list will enable a check when a servlet calledContextHandler.APIContext.getContext(String), validating that the uriInPath for the given webapp has been declaratively allows access to the context.- Parameters:
contextWhiteList- the whitelist of contexts forContextHandler.APIContext.getContext(String)
-
setTempDirectory
Set temporary directory for context. The "javax.servlet.context.tempdir" attribute is also set.- Parameters:
dir- Writable temporary directory.
-
getTempDirectory
@ManagedAttribute(value="temporary directory location", readonly=true) public File getTempDirectory() -
makeTempDirectory
-
getCanonicalNameForTmpDir
-
getNestedResourceForTempDirName
- Overrides:
getNestedResourceForTempDirNamein classContextHandler
-
setPersistTempDirectory
public void setPersistTempDirectory(boolean persist) If true the temp directory for this webapp will be kept when the webapp stops. Otherwise, it will be deleted.- Parameters:
persist- true to persist the temp directory on shutdown / exit of the webapp
-
isPersistTempDirectory
public boolean isPersistTempDirectory()- Returns:
- true if tmp directory will persist between startups of the webapp
-
setWar
Set the war of the webapp. From this value aContextHandler.setResourceBase(String)value is computed byWebInfConfiguration, which may be changed from the war URI by unpacking and/or copying.- Parameters:
war- The war to set as a file name or URL.
-
setWarResource
-
getExtraClasspath
@ManagedAttribute(value="extra classpath for context classloader", readonly=true) public List<Resource> getExtraClasspath()- Specified by:
getExtraClasspathin interfaceWebAppClassLoader.Context- Returns:
- Comma or semicolon separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.
-
setExtraClasspath
Set the Extra ClassPath via delimited String.This is a convenience method for
setExtraClasspath(List))}- Parameters:
extraClasspath- Comma or semicolon separated path of filenames or URLs pointing to directories or jar files. Directories should end with '/'.- Throws:
IOException- if unable to resolve the resources referenced- See Also:
-
setExtraClasspath
-
isLogUrlOnStart
public boolean isLogUrlOnStart() -
setLogUrlOnStart
public void setLogUrlOnStart(boolean logOnStart) Sets whether or not the web app name and URL is logged on startup- Parameters:
logOnStart- whether or not the log message is created
-
isAllowDuplicateFragmentNames
public boolean isAllowDuplicateFragmentNames() -
setAllowDuplicateFragmentNames
public void setAllowDuplicateFragmentNames(boolean allowDuplicateFragmentNames) -
startContext
Description copied from class:ServletContextHandlerFinish constructing handlers and link them together.- Overrides:
startContextin classServletContextHandler- Throws:
Exception- if unable to start the context- See Also:
-
stopContext
- Overrides:
stopContextin classServletContextHandler- Throws:
Exception
-
startWebapp
Continue thestartContext()before callingsuper.startContext().- Throws:
Exception- If there was a problem starting
-
stopWebapp
Continue thestopContext()before callingsuper.stopContext().- Throws:
Exception- If there was a problem stopping
-
setServletSecurity
public Set<String> setServletSecurity(javax.servlet.ServletRegistration.Dynamic registration, javax.servlet.ServletSecurityElement servletSecurityElement) Description copied from class:ServletContextHandlerDelegate for ServletRegistration.Dynamic.setServletSecurity method- Overrides:
setServletSecurityin classServletContextHandler- Parameters:
registration- ServletRegistration.Dynamic instance that setServletSecurity was called onservletSecurityElement- new security info- Returns:
- the set of exact URL mappings currently associated with the registration that are also present in the web.xml security constraints and thus will be unaffected by this call.
-
getMetaData
-
addServerClasses
@Deprecated(since="12.0.8", forRemoval=true) public static void addServerClasses(Attributes attributes, String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.Add a Server Class pattern to use for all ee8 WebAppContexts.- Parameters:
attributes- TheServerinstance to add classes topatterns- the patterns to use- See Also:
-
addSystemClasses
@Deprecated(since="12.0.8", forRemoval=true) public static void addSystemClasses(Attributes attributes, String... patterns) Deprecated, for removal: This API element is subject to removal in a future version.Add a System Class pattern to use for all ee8 WebAppContexts.- Parameters:
attributes- TheServerinstance to add classes topatterns- the patterns to use- See Also:
-
WebAppClassLoading.DEFAULT_HIDDEN_CLASSES