Class StandardContext
- java.lang.Object
-
- org.apache.catalina.core.ContainerBase
-
- org.apache.catalina.core.StandardContext
-
- Direct Known Subclasses:
PwcWebModule
public class StandardContext extends ContainerBase implements Context, jakarta.servlet.ServletContext
Standard implementation of the Context interface. Each child container must be a Wrapper implementation to process the requests directed to a particular servlet.- Version:
- $Revision: 1.48 $ $Date: 2007/07/25 00:52:04 $
- Author:
- Craig R. McClanahan, Remy Maucherat
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StandardContext.RestrictedServletContextListener
-
Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
allowLinking
Allow linking.protected int
cacheMaxSize
Cache max size in KB.protected int
cacheTTL
Cache TTL in ms.protected boolean
caseSensitive
Case sensitivity.protected boolean
caseSensitiveMapping
protected ApplicationContext
context
The ServletContext implementation associated with this Context.protected ArrayList<jakarta.servlet.ServletContextListener>
contextListeners
The list of ServletContextListenersprotected boolean
directoryDeployed
protected boolean
directoryListing
Should we generate directory listings?protected ConcurrentMap<String,FilterRegistrationImpl>
filterRegisMap
protected boolean
isJsfApplication
Is the context contains the JSF servlet.protected ConcurrentMap<String,ServletRegistrationImpl>
servletRegisMap
protected int
servletReloadCheckSecs
protected boolean
showArchivedRealPathEnabled
protected static URLEncoder
urlEncoder
Array containing the safe characters set.-
Fields inherited from class org.apache.catalina.core.ContainerBase
backgroundProcessorDelay, checkIfRequestIsSecure, children, controller, debug, domain, hasCustomPipeline, initialized, lifecycle, listeners, loader, log, logger, manager, name, notifyContainerListeners, oname, parent, parentClassLoader, pipeline, rb, readLock, realm, resources, started, support, writeLock
-
Fields inherited from interface org.apache.catalina.Container
ADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENT
-
Fields inherited from interface org.apache.catalina.Context
RELOAD_EVENT
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description StandardContext()
Create a new StandardContext component with the default basic Valve.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlternateDocBase(String urlPattern, String docBase)
Configures this context's alternate doc base mappings.void
addApplicationListener(String listener)
Adds the Listener with the given class name that is declared in the deployment descriptor to the set of Listeners configured for this application.void
addApplicationParameter(ApplicationParameter parameter)
Add a new application parameter for this application.void
addChild(Container child)
Adds the given child Container to this context.protected void
addChild(Container child, boolean isProgrammatic, boolean createRegistration)
Adds the given child (Servlet) to this context.void
addConstraint(SecurityConstraint constraint)
Add a security constraint to the set for this web application.void
addEjb(ContextEjb ejb)
Add an EJB resource reference for this web application.String
addEnvironment(String envName, String type)
Add an environment entry for this web application.void
addEnvironment(ContextEnvironment environment)
Add an environment entry for this web application.void
addErrorPage(ErrorPage errorPage)
Add an error page for the specified error or Java exception.jakarta.servlet.FilterRegistration.Dynamic
addFilter(String filterName, jakarta.servlet.Filter filter)
jakarta.servlet.FilterRegistration.Dynamic
addFilter(String filterName, Class<? extends jakarta.servlet.Filter> filterClass)
Adds the filter with the given name and class type to this servlet context.jakarta.servlet.FilterRegistration.Dynamic
addFilter(String filterName, String className)
Adds the filter with the given name and class name to this servlet context.void
addFilterDef(FilterDef filterDef)
Add a filter definition to this Context.void
addFilterDef(FilterDef filterDef, boolean isProgrammatic, boolean createRegistration)
Add a filter definition to this Context.void
addFilterMap(FilterMap filterMap)
Add a filter mapping to this Context.void
addFilterMap(FilterMap filterMap, boolean isMatchAfter)
Add a filter mapping to this Context.void
addFilterMaps(FilterMaps filterMaps)
Add multiple filter mappings to this Context.void
addInstanceListener(String listener)
Add the classname of an InstanceListener to be added to each Wrapper appended to this Context.void
addInstanceListener(InstanceListener listener)
jakarta.servlet.ServletRegistration.Dynamic
addJspFile(String servletName, String jspFile)
void
addJspMapping(String pattern)
Add the given URL pattern as a jsp-property-group.void
addListener(Class<? extends EventListener> listenerClass)
Adds a listener of the given class type to this ServletContext.void
addListener(String className)
Adds the listener with the given class name to this ServletContext.<T extends EventListener>
voidaddListener(T t)
Adds the given listener instance to this ServletContext.void
addLocaleEncodingMappingParameter(String locale, String encoding)
Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)void
addLocalEjb(ContextLocalEjb ejb)
Add a local EJB resource reference for this web application.void
addMessageDestination(MessageDestination md)
Add a message destination for this web application.void
addMessageDestinationRef(MessageDestinationRef mdr)
Add a message destination reference for this web application.void
addMimeMapping(String extension, String mimeType)
Add a new MIME mapping, replacing any existing mapping for the specified extension.void
addParameter(String name, String value)
Add a new context initialization parameter.String
addResource(String resourceName, String type)
Add a resource reference for this web application.void
addResource(ContextResource resource)
Add a resource reference for this web application.void
addResourceEnvRef(String name, String type)
Add a resource environment reference for this web application.String
addResourceLink(String resourceLinkName, String global, String name, String type)
Add a resource link for this web application.void
addResourceLink(ContextResourceLink resourceLink)
Add a resource link for this web application.void
addResourceParams(ResourceParams resourceParameters)
Add resource parameters for this web application.void
addRoleMapping(String role, String link)
Add a security role reference for this web application.void
addSecurityRole(String role)
Add a new security role for this web application.jakarta.servlet.ServletRegistration.Dynamic
addServlet(String servletName, jakarta.servlet.Servlet servlet)
jakarta.servlet.ServletRegistration.Dynamic
addServlet(String servletName, jakarta.servlet.Servlet instance, Map<String,String> initParams)
Adds the given servlet instance with the given name to this servlet context and initializes it.jakarta.servlet.ServletRegistration.Dynamic
addServlet(String servletName, jakarta.servlet.Servlet servlet, Map<String,String> initParams, String... urlPatterns)
Adds the given servlet instance with the given name and URL patterns to this servlet context, and initializes it.jakarta.servlet.ServletRegistration.Dynamic
addServlet(String servletName, Class<? extends jakarta.servlet.Servlet> servletClass)
jakarta.servlet.ServletRegistration.Dynamic
addServlet(String servletName, String className)
void
addServletMapping(String pattern, String name)
Adds the given servlet mapping to this Context, overriding any existing mapping for the specified pattern.Set<String>
addServletMapping(String name, String[] urlPatterns)
Adds the given servlet mappings to this Context.void
addServletMapping(String pattern, String name, boolean jspWildCard)
Adds the given servlet mapping to this Context, overriding any existing mapping for the specified pattern.Set<String>
addServletMapping(ServletMap servletMap)
Adds the given servlet mappings to this Context.void
addWatchedResource(String name)
Add a new watched resource to the set recognized by this Context.void
addWelcomeFile(String name)
Add a new welcome file to the set recognized by this Context.void
addWrapperLifecycle(String listener)
Add the classname of a LifecycleListener to be added to each Wrapper appended to this Context.void
addWrapperListener(String listener)
Add the classname of a ContainerListener to be added to each Wrapper appended to this Context.protected String
adjustURLPattern(String urlPattern)
Adjust the URL pattern to begin with a leading slash, if appropriate (i.e.void
alternateResourcesStart()
Starts this context's alternate doc base resources.boolean
alternateResourcesStop()
Stops this context's alternate doc base resources.void
backgroundProcess()
Execute a periodic task, such as reloading, etc.protected void
callServletContainerInitializers()
protected void
contextListenerStart()
Notifies all ServletContextListeners at their contextInitialized method.void
create()
protected ServletRegistrationImpl
createDynamicServletRegistrationImpl(StandardWrapper wrapper)
<T extends jakarta.servlet.Filter>
TcreateFilter(Class<T> clazz)
Instantiates the given Filter class and performs any required resource injection into the new Filter instance before returning it.protected <T extends jakarta.servlet.Filter>
TcreateFilterInstance(Class<T> clazz)
Instantiates the given Filter class.<T extends jakarta.servlet.http.HttpUpgradeHandler>
TcreateHttpUpgradeHandlerInstance(Class<T> clazz)
Instantiates the given HttpUpgradeHandler class.<T extends EventListener>
TcreateListener(Class<T> clazz)
Instantiates the given EventListener class and performs any required resource injection into the new EventListener instance before returning it.<T extends EventListener>
TcreateListenerInstance(Class<T> clazz)
Instantiates the given EventListener class.void
createLoader()
Creates a classloader for this context.ObjectInputStream
createObjectInputStream(InputStream is)
Creates an ObjectInputStream that provides special deserialization logic for classes that are normally not serializable (such as javax.naming.Context).ObjectName
createObjectName(String hostDomain, ObjectName parentName)
ObjectName
createObjectName(ContextEnvironment environment)
Create anObjectName
forContextEnvironment
object.ObjectName
createObjectName(ContextResource resource)
Create anObjectName
forContextResource
object.ObjectName
createObjectName(ContextResourceLink resourceLink)
Create anObjectName
forContextResourceLink
object.ObjectOutputStream
createObjectOutputStream(OutputStream os)
Creates an ObjectOutputStream that provides special serialization logic for classes that are normally not serializable (such as javax.naming.Context).<T extends jakarta.servlet.Servlet>
TcreateServlet(Class<T> clazz)
Instantiates the given Servlet class and performs any required resource injection into the new Servlet instance before returning it.protected <T extends jakarta.servlet.Servlet>
TcreateServletInstance(Class<T> clazz)
Instantiates the given Servlet class.protected ServletRegistrationImpl
createServletRegistrationImpl(StandardWrapper wrapper)
Wrapper
createWrapper()
Factory method to create and return a new Wrapper instance, of the Java implementation class appropriate for this Context implementation.void
declareRoles(String... roleNames)
void
destroy()
Destroys this context by cleaning it up completely.protected File
engineBase()
Return a File object representing the base directory for the entire servlet container (i.e.boolean
filterStart()
Configure and initialize the set of filters for this Context.boolean
filterStop()
Finalize and release the set of filters for this Context.List<ApplicationParameter>
findApplicationParameters()
Return the set of application parameters for this application.ContextEjb
findEjb(String name)
Return the EJB resource reference with the specified name, if any; otherwise, returnnull
.ContextEjb[]
findEjbs()
Return the defined EJB resource references for this application.ContextEnvironment
findEnvironment(String name)
Return the environment entry with the specified name, if any; otherwise, returnnull
.ContextEnvironment[]
findEnvironments()
Return the set of defined environment entries for this web application.ErrorPage
findErrorPage(int errorCode)
Return the error page entry for the specified HTTP error code, if any; otherwise returnnull
.ErrorPage
findErrorPage(String exceptionType)
Return the error page entry for the specified Java exception type, if any; otherwise returnnull
.jakarta.servlet.FilterConfig
findFilterConfig(String name)
Find and return the initializedFilterConfig
for the specified filter name, if any; otherwise returnnull
.FilterDef
findFilterDef(String filterName)
Return the filter definition for the specified filter name, if any; otherwise returnnull
.FilterDef[]
findFilterDefs()
Return the set of defined filters for this Context.List<FilterMap>
findFilterMaps()
Return the list of filter mappings for this Context.List<String>
findInstanceListeners()
Return the list of InstanceListener classes that will be added to newly created Wrappers automatically.ContextLocalEjb
findLocalEjb(String name)
Return the local EJB resource reference with the specified name, if any; otherwise, returnnull
.ContextLocalEjb[]
findLocalEjbs()
Return the defined local EJB resource references for this application.Context
findMappingObject()
FIXME: Fooling introspection ...MessageDestination
findMessageDestination(String name)
Return the message destination with the specified name, if any; otherwise, returnnull
.MessageDestinationRef
findMessageDestinationRef(String name)
Return the message destination ref with the specified name, if any; otherwise, returnnull
.MessageDestinationRef[]
findMessageDestinationRefs()
Return the set of defined message destination refs for this web application.MessageDestination[]
findMessageDestinations()
Return the set of defined message destinations for this web application.String
findMimeMapping(String extension)
Return the MIME type to which the specified extension is mapped, if any; otherwise returnnull
.String[]
findMimeMappings()
Return the extensions for which MIME mappings are defined.String
findParameter(String name)
Return the value for the specified context initialization parameter name, if any; otherwise returnnull
.String[]
findParameters()
Return the names of all defined context initialization parameters for this Context.ContextResource
findResource(String name)
Return the resource reference with the specified name, if any; otherwise returnnull
.String
findResourceEnvRef(String name)
Return the resource environment reference type for the specified name, if any; otherwise returnnull
.String[]
findResourceEnvRefs()
Return the set of resource environment reference names for this web application.ContextResourceLink
findResourceLink(String name)
Return the resource link with the specified name, if any; otherwise returnnull
.ContextResourceLink[]
findResourceLinks()
Return the defined resource links for this application.ContextResource[]
findResources()
Return the defined resource references for this application.String
findRoleMapping(String role)
For the given security role (as used by an application), return the corresponding role name (as defined by the underlying Realm) if there is one.String
findServletMapping(String pattern)
Return the servlet name mapped by the specified pattern (if any); otherwise returnnull
.String[]
findServletMappings()
Return the patterns of all defined servlet mappings for this Context.DirContext
findStaticResources()
Return the naming resources associated with this web application.ErrorPage
findStatusPage(int status)
Return the context-relative URI of the error page for the specified HTTP status code, if any; otherwise returnnull
.int[]
findStatusPages()
Return the set of HTTP status codes for which error pages have been specified.boolean
findWelcomeFile(String name)
Returntrue
if the specified welcome file is defined for this Context; otherwise returnfalse
.String[]
findWelcomeFiles()
Return the set of welcome files defined for this Context.List<String>
findWrapperLifecycles()
Return the list of LifecycleListener classes that will be added to newly created Wrappers automatically.List<String>
findWrapperListeners()
Return the list of ContainerListener classes that will be added to newly created Wrappers automatically.void
fireRequestDestroyedEvent(jakarta.servlet.ServletRequest request)
Notifies all ServletRequestListener instances configured for this Context of the requestDestroyed event.void
fireRequestInitializedEvent(jakarta.servlet.ServletRequest request)
Notifies all ServletRequestListener instances configured for this Context of the requestInitialized event.String
getAdHocServletName(String path)
Returns the name of the ad-hoc servlet responsible for servicing the given path.boolean
getAllowRelativeRedirect()
Return whether this context allows sendRedirect() to redirect to a relative URL.String
getAltDDName()
Return the alternate Deployment Descriptor name.ArrayList<org.glassfish.grizzly.http.server.util.AlternateDocBase>
getAlternateDocBases()
Gets this context's configured alternate doc bases.boolean
getAntiJARLocking()
Return the antiJARLocking flag for this Context.List<EventListener>
getApplicationEventListeners()
Object
getAttribute(String name)
Return the value of the specified context attribute, if any; otherwise returnnull
.Enumeration<String>
getAttributeNames()
Return an enumeration of the names of the context attributes associated with this context.Auditor[]
getAuditors()
Get Auditors associated with this context, if any.Authenticator
getAuthenticator()
Gets the Authenticator of this Context.boolean
getAvailable()
Return the application available flag for this Context.int
getCacheMaxSize()
Return the maximum size of the cache in KB.int
getCacheTTL()
Get cache TTL.CharsetMapper
getCharsetMapper()
Return the Locale to character set mapper for this Context.String
getCharsetMapperClass()
Return the Locale to character set mapper class for this Context.ClassLoader
getClassLoader()
Gets the class loader of the web application represented by this ServletContext.String
getCompilerClasspath()
Return the compiler classpath.String
getConfigFile()
Return the path to a file to save this Context information.boolean
getConfigured()
Return the "correctly configured" flag for this Context.List<SecurityConstraint>
getConstraints()
Gets the security constraints defined for this web application.jakarta.servlet.ServletContext
getContext(String uri)
Return aServletContext
object that corresponds to a specified URI on the server.String
getContextPath()
Returns the context path of the web application.boolean
getCookies()
Return the "use cookies for session ids" flag.boolean
getCrossContext()
Return the "allow crossing servlet contexts" flag.protected String
getDefaultConfigFile()
Given a context path, get the config file name.ErrorPage
getDefaultErrorPage()
Gets the default error page of this context.Set<jakarta.servlet.SessionTrackingMode>
getDefaultSessionTrackingModes()
Gets the session tracking modes that are supported by default for this ServletContext.String
getDefaultWebXml()
boolean
getDelegate()
Return the "follow standard delegation model" flag used to configure our ClassLoader.String
getDisplayName()
Return the display name of this web application.boolean
getDistributable()
Return the distributable flag for this web application.String
getDocBase()
Return the document root for this Context.int
getEffectiveMajorVersion()
int
getEffectiveMinorVersion()
Set<jakarta.servlet.SessionTrackingMode>
getEffectiveSessionTrackingModes()
Gets the session tracking modes that are in effect for this ServletContext.String
getEncodedPath()
Return the URL encoded context path, using UTF-8.String
getEngineName()
String[]
getEnvironments()
Return the MBean Names of the set of defined environment entries for this web applicationjakarta.servlet.FilterRegistration
getFilterRegistration(String filterName)
Gets the FilterRegistration corresponding to the filter with the given filterName.Map<String,? extends jakarta.servlet.FilterRegistration>
getFilterRegistrations()
Gets a Map of the FilterRegistration objects corresponding to all currently registered filters.String
getHostname()
String
getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format<description>/<version>
.String
getInitParameter(String name)
Return the value of the specified initialization parameter, ornull
if this parameter does not exist.Enumeration<String>
getInitParameterNames()
Return the names of the context's initialization parameters, or an empty enumeration if the context has no initialization parameters.String
getJ2EEApplication()
String
getJ2EEServer()
jakarta.servlet.descriptor.JspConfigDescriptor
getJspConfigDescriptor()
Gets the<jsp-config>
related configuration that was aggregated over theweb.xml
andweb-fragment.xml
resources of the web application represented by this ServletContext.String
getJvmRoute()
LoginConfig
getLoginConfig()
Return the login configuration descriptor for this web application.int
getMajorVersion()
Return the major version of the Java Servlet API that we implement.int
getManagerChecksFrequency()
Return the frequency of manager checks.org.glassfish.grizzly.http.server.util.Mapper
getMapper()
Get the mapper associated with the context.String
getMimeType(String file)
Return the MIME type of the specified file, ornull
if the MIME type cannot be determined.int
getMinorVersion()
Return the minor version of the Java Servlet API that we implement.jakarta.servlet.RequestDispatcher
getNamedDispatcher(String name)
Return aRequestDispatcher
object that acts as a wrapper for the named servlet.String
getNamingContextName()
Get naming context full name.NamingResources
getNamingResources()
Return the naming resources associated with this web application.String
getOriginalDocBase()
Gets the original document root for this Context, which can be an absolute pathname, a relative pathname, or a URL.boolean
getOverride()
Return the DefaultContext override flag for this web application.ObjectName
getParentName()
Gets the name of the parent containerString
getPath()
Return the context path for this Context.boolean
getPaused()
boolean
getPrivileged()
Return the privileged flag for this web application.String
getPublicId()
Return the public identifier of the deployment descriptor DTD that is currently being parsed.String
getRealPath(String path)
Return the real path corresponding to the given virtual path, ornull
if the container was unable to perform the translationboolean
getReloadable()
Return the reloadable flag for this web application.String
getRequestCharacterEncoding()
jakarta.servlet.RequestDispatcher
getRequestDispatcher(String path)
Return aRequestDispatcher
instance that acts as a wrapper for the resource at the given path.URL
getResource(String path)
Return the URL to the resource that is mapped to a specified path.InputStream
getResourceAsStream(String path)
Return the requested resource as anInputStream
.String[]
getResourceLinks()
Return the MBean Names of all the defined resource links for this applicationString[]
getResourceNames()
Return the MBean Names of all the defined resource references for this application.Set<String>
getResourcePaths(String path)
Return a Set containing the resource paths of resources member of the specified collection.String
getResponseCharacterEncoding()
boolean
getReuseSessionID()
Return the "reuse session IDs when creating sessions" flagString
getServerInfo()
Return the name and version of the servlet container.jakarta.servlet.ServletContext
getServletContext()
Return the servlet context for which this Context is a facade.String
getServletContextName()
Return the display name of this web application.Collection<String>
getServletNameFilterMappings(String filterName)
Gets the current servlet name mappings of the Filter with the given name.jakarta.servlet.ServletRegistration
getServletRegistration(String servletName)
Gets the ServletRegistration corresponding to the servlet with the given servletName.Map<String,? extends jakarta.servlet.ServletRegistration>
getServletRegistrations()
Gets a Map of the ServletRegistration objects corresponding to all currently registered servlets.jakarta.servlet.SessionCookieConfig
getSessionCookieConfig()
Gets the session tracking cookie configuration of this ServletContext.String
getSessionCookieName()
Gets the name that will be assigned to any session tracking cookies created on behalf of this contextList<jakarta.servlet.http.HttpSessionListener>
getSessionListeners()
String
getSessionParameterName()
int
getSessionTimeout()
Return the default session timeout (in minutes) for this web application.long
getStartTimeMillis()
Gets the time this context was started.long
getStartupTime()
Gets the time (in milliseconds) it took to start this context.int
getState()
Returns the state of the server.DirContext
getStaticResources()
Return the naming resources associated with this web application.boolean
getTldNamespaceAware()
Get the server.xmlattribute's xmlNamespaceAware. long
getTldScanTime()
boolean
getTldValidation()
Get the server.xmlattribute's webXmlValidation. protected org.glassfish.hk2.classmodel.reflect.Types
getTypes()
long
getUniqueId()
long
getUnloadDelay()
Return the value of the unloadDelay flag.boolean
getUnpackWAR()
Unpack WAR flag accessor.Collection<String>
getUrlPatternFilterMappings(String filterName)
Gets the current URL pattern mappings of the Filter with the given name.String
getVirtualServerName()
List<String>
getWatchedResources()
Gets the watched resources defined for this web application.String[]
getWelcomeFiles()
Return the naming resources associated with this web application.String
getWorkDir()
Return the work directory for this Context.String
getWorkPath()
Get the absolute path to the work dir.boolean
getXmlNamespaceAware()
Get the server.xmlattribute's xmlNamespaceAware. boolean
getXmlValidation()
Get the server.xmlattribute's xmlValidation. boolean
hasAdHocPaths()
Indicates whether this web module contains any ad-hoc paths.boolean
hasConstraints()
Checks whether this web application has any security constraints defined.boolean
hasFilter(jakarta.servlet.Filter filter)
Checks whether this context contains the given Filter instanceboolean
hasSecurityRole(String role)
Checks if the given security role is defined for this application.boolean
hasServlet(jakarta.servlet.Servlet servlet)
Checks whether this context contains the given Servlet instanceboolean
hasWatchedResources()
Checks whether this web application has any watched resources defined.void
init()
Init method, part of the MBean lifecycle.boolean
isAllowLinking()
Is linking allowed.boolean
isCachingAllowed()
Is caching allowed ?boolean
isCaseSensitive()
Is case sensitive ?boolean
isCaseSensitiveMapping()
Are filters and security constraints mapped in a case sensitive manner?boolean
isDirectoryListing()
Checks whether directory listings are enabled or disabled on this Context.boolean
isEmbedded()
boolean
isEnableURLRewriting()
Checks whether the rewriting of URLs with the jsessionids of HTTP sessions belonging to this context is enabled or not.boolean
isEventProvider()
???boolean
isFilesystemBased()
boolean
isJsfApplication()
Scan the parent when searching for TLD listeners.boolean
isReload()
boolean
isReplaceWelcomeFiles()
Return the "replace welcome files" property.boolean
isSecurePagesWithPragma()
Returns the value of the securePagesWithPragma property.protected boolean
isServlet22()
Are we processing a version 2.2 deployment descriptor?boolean
isSessionTimeoutOveridden()
Is the session timeout (in minutes) for this web application over-ridden from the default HERCULES:addprotected boolean
isStandalone()
boolean
isStatisticsProvider()
???MBean stats? unusedboolean
isUseMyFaces()
boolean
isUseNaming()
Returns true if the internal naming support is used.protected EventListener
loadListener(ClassLoader loader, String listenerClassName)
Loads and instantiates the listener with the specified classname.void
loadOnStartup(Container[] children)
Load and initialize all servlets marked "load on startup" in the web application deployment descriptor.void
log(String message)
Writes the specified message to a servlet log file.void
log(String message, Throwable throwable)
Writes the specified message and exception to a servlet log file.protected void
managerStart()
Starts the session manager of this Context.protected void
managerStop()
Stops the session manager of this Context.void
reload()
Reload this web application, if reloading is supported.void
removeApplicationParameter(String name)
Remove the application parameter with the specified name from the set for this application.void
removeAttribute(String name)
Remove the context attribute with the specified name, if any.void
removeChild(Container child)
Removes the given child container.void
removeConstraints()
Removes any security constraints from this web application.void
removeEjb(String name)
Remove any EJB resource reference with the specified name.void
removeEnvironment(String name)
Remove any environment entry with the specified name.void
removeErrorPages()
Removes any error page declarations.void
removeFilterDef(FilterDef filterDef)
Remove the specified filter definition from this Context, if it exists; otherwise, no action is taken.void
removeFilterMaps()
Removes any filter mappings from this Context.void
removeInstanceListener(String listener)
Remove a class name from the list of InstanceListener classes that will be added to newly created Wrappers.void
removeLocalEjb(String name)
Remove any local EJB resource reference with the specified name.void
removeMessageDestination(String name)
Remove any message destination with the specified name.void
removeMessageDestinationRef(String name)
Remove any message destination ref with the specified name.void
removeMimeMapping(String extension)
Remove the MIME mapping for the specified extension, if it exists; otherwise, no action is taken.void
removeParameter(String name)
Remove the context initialization parameter with the specified name, if it exists; otherwise, no action is taken.protected void
removePatternFromServlet(Wrapper wrapper, String pattern)
This method is overridden in web-glue to also remove the given mapping from the deployment backend's WebBundleDescriptor.void
removeResource(String resourceName)
Remove any resource reference with the specified name.void
removeResourceEnvRef(String name)
Remove any resource environment reference with the specified name.void
removeResourceLink(String link)
Remove any resource link with the specified name.void
removeRoleMapping(String role)
Remove any security role reference for the specified namevoid
removeSecurityRoles()
Removes any security roles defined for this application.void
removeServletMapping(String pattern)
Remove any servlet mapping for the specified pattern, if it exists; otherwise, no action is taken.void
removeWatchedResources()
Clears any watched resources defined for this web application.void
removeWelcomeFiles()
void
removeWrapperLifecycles()
Removes any Wrapper lifecycle listeners from this Contextvoid
removeWrapperListeners()
Removes any Wrapper listeners from this Contextboolean
resourcesStart()
Allocate resources, including proxy.boolean
resourcesStop()
Deallocate resources and destroy proxy.void
restrictedSetPipeline(Pipeline pl)
Sets a new pipelinevoid
sendNotification(Notification notification)
void
sessionActivatedEndEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionActivatedStartEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionCreatedEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionDestroyedEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionExpiredEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionPassivatedEndEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionPassivatedStartEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionPersistedEndEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionPersistedStartEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoringvoid
sessionRejectedEvent(int maxSessions)
Trigger for monitoringvoid
setAllowLinking(boolean allowLinking)
Set allow linking.void
setAllowRelativeRedirect(boolean allowRelativeURLs)
Set whether this context allows sendRedirect() to redirect to a relative URL.void
setAltDDName(String altDDName)
Set an alternate Deployment Descriptor name.void
setAntiJARLocking(boolean antiJARLocking)
Set the antiJARLocking feature for this Context.void
setAttribute(String name, Object value)
Bind the specified value with the specified context attribute name, replacing any existing value for that name.void
setAuditors(Auditor[] auditor)
Set the Auditors associated with this context.void
setAvailable(boolean available)
Set the application available flag for this Context.void
setCacheMaxSize(int cacheMaxSize)
Set the maximum size of the cache in KB.void
setCacheTTL(int cacheTTL)
Set cache TTL.void
setCachingAllowed(boolean cachingAllowed)
Set caching allowed flag.void
setCaseSensitive(boolean caseSensitive)
Set case sensitivity.void
setCaseSensitiveMapping(boolean caseSensitiveMap)
Set case sensitivity for filter and security constraint mappings.void
setCharsetMapper(CharsetMapper mapper)
Set the Locale to character set mapper for this Context.void
setCharsetMapperClass(String mapper)
Set the Locale to character set mapper class for this Context.void
setCompilerClasspath(String compilerClasspath)
Set the compiler classpath.void
setConfigFile(String configFile)
Set the path to a file to save this Context information.void
setConfigured(boolean configured)
Sets the "correctly configured" flag for this Context.void
setCookies(boolean cookies)
Set the "use cookies for session ids" flag.void
setCrossContext(boolean crossContext)
Sets the "allow crossing servlet contexts" flag.void
setDefaultWebXml(String defaultWebXml)
Set the location of the default web xml that will be used.void
setDelegate(boolean delegate)
Set the "follow standard delegation model" flag used to configure our ClassLoader.void
setDirectoryListing(boolean directoryListing)
Enables or disables directory listings on this Context.void
setDisplayName(String displayName)
Set the display name of this web application.void
setDistributable(boolean distributable)
Set the distributable flag for this web application.void
setDocBase(String docBase)
Set the document root for this Context.void
setEffectiveMajorVersion(int effectiveMajorVersion)
void
setEffectiveMinorVersion(int effectiveMinorVersion)
void
setEmbedded(boolean isEmbedded)
void
setEnableURLRewriting(boolean enableURLRewriting)
Enables or disables the rewriting of URLs with the jsessionids of HTTP sessions belonging to this context.void
setEngineName(String engineName)
boolean
setInitParameter(String name, String value)
void
setJ2EEApplication(String j2EEApplication)
void
setJ2EEServer(String j2EEServer)
void
setJspConfigDescriptor(jakarta.servlet.descriptor.JspConfigDescriptor jspConfigDesc)
void
setJvmRoute(String jvmRoute)
void
setLoginConfig(LoginConfig config)
Set the login configuration descriptor for this web application.void
setManagerChecksFrequency(int managerChecksFrequency)
Set the manager checks frequency.void
setName(String name)
Set a name string (suitable for use by humans) that describes this Container.void
setNamingResources(NamingResources namingResources)
Set the naming resources for this web application.void
setOrderedLibs(List<String> orderedLibs)
Sets the list of ordered libs, which will be used as the value of the ServletContext attribute with name jakarta.servlet.context.orderedLibsvoid
setOriginalDocBase(String docBase)
Set the original document root for this Context, which can be an absolute pathname, a relative pathname, or a URL.void
setOverride(boolean override)
Set the DefaultContext override flag for this web application.void
setPath(String path)
Set the context path for this Context.void
setPrivileged(boolean privileged)
Set the privileged flag for this web application.void
setPublicId(String publicId)
Set the public identifier of the deployment descriptor DTD that is currently being parsed.void
setReload(boolean isReload)
void
setReloadable(boolean reloadable)
Set the reloadable flag for this web application.void
setReplaceWelcomeFiles(boolean replaceWelcomeFiles)
Set the "replace welcome files" property.void
setRequestCharacterEncoding(String encoding)
void
setResources(DirContext resources)
Set the resources DirContext object with which this Container is associated.void
setResponseCharacterEncoding(String encoding)
void
setReuseSessionID(boolean reuse)
Set the "reuse session IDs when creating sessions" flagvoid
setSecurePagesWithPragma(boolean securePagesWithPragma)
Sets the securePagesWithPragma property of this Context.void
setServletContainerInitializerInterestList(Iterable<jakarta.servlet.ServletContainerInitializer> initializers)
void
setSessionTimeout(int timeout)
Set the default session timeout (in minutes) for this web application.void
setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)
Sets the session tracking modes that are to become effective for this ServletContext.void
setStartupTime(long startupTime)
void
setTldNamespaceAware(boolean tldNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.void
setTldScanTime(long tldScanTime)
void
setTldValidation(boolean tldValidation)
Set the validation feature of the XML parser used when parsing tlds files.void
setUnloadDelay(long unloadDelay)
Set the value of the unloadDelay flag, which represents the amount of ms that the container will wait when unloading servlets.void
setUnpackWAR(boolean unpackWAR)
Unpack WAR flag mutator.void
setUseMyFaces(boolean useMyFaces)
void
setUseNaming(boolean useNaming)
Enables or disables naming.void
setWorkDir(String workDir)
Set the work directory for this Context.void
setXmlNamespaceAware(boolean webXmlNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.void
setXmlValidation(boolean webXmlValidation)
Set the validation feature of the XML parser used when parsing xml instances.void
start()
Start this Context component.void
startRecursive()
void
stop()
Stop this Context component.void
stop(boolean isShutdown)
Stop this Context component.String
toString()
Return a String representation of this component.protected boolean
validateURLPattern(String urlPattern)
Validate the syntax of a proposed<url-pattern>
for conformance with specification requirements.-
Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, addLifecycleListener, addPropertyChangeListener, addValve, addValve, findChild, findChildren, findContainerListeners, findLifecycleListeners, fireContainerEvent, getBackgroundProcessorDelay, getBasic, getChildren, getContainerSuffix, getDebug, getDomain, getJmxName, getLoader, getLogger, getManager, getMappingObject, getName, getObjectName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, getValveObjectNames, getValves, hasCustomPipeline, hasNonBasicValves, invoke, isCheckIfRequestIsSecure, logName, removeContainerListener, removeLifecycleListener, removeLifecycleListeners, removePropertyChangeListener, removeValve, setBackgroundProcessorDelay, setBasic, setCheckIfRequestIsSecure, setDebug, setDomain, setLoader, setLogger, setManager, setParent, setParentClassLoader, setRealm, startChildren, threadStart, threadStop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.catalina.Container
addContainerListener, addPropertyChangeListener, findChild, findChildren, findContainerListeners, fireContainerEvent, getBackgroundProcessorDelay, getLoader, getLogger, getManager, getMappingObject, getName, getParent, getParentClassLoader, getPipeline, getRealm, getResources, hasCustomPipeline, invoke, isCheckIfRequestIsSecure, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCheckIfRequestIsSecure, setLoader, setLogger, setManager, setParent, setParentClassLoader, setRealm
-
-
-
-
Field Detail
-
urlEncoder
protected static final URLEncoder urlEncoder
Array containing the safe characters set.
-
contextListeners
protected ArrayList<jakarta.servlet.ServletContextListener> contextListeners
The list of ServletContextListeners
-
context
protected ApplicationContext context
The ServletContext implementation associated with this Context.
-
caseSensitive
protected boolean caseSensitive
Case sensitivity.
-
allowLinking
protected boolean allowLinking
Allow linking.
-
cacheMaxSize
protected int cacheMaxSize
Cache max size in KB.
-
cacheTTL
protected int cacheTTL
Cache TTL in ms.
-
caseSensitiveMapping
protected boolean caseSensitiveMapping
-
isJsfApplication
protected boolean isJsfApplication
Is the context contains the JSF servlet.
-
servletRegisMap
protected ConcurrentMap<String,ServletRegistrationImpl> servletRegisMap
-
filterRegisMap
protected ConcurrentMap<String,FilterRegistrationImpl> filterRegisMap
-
directoryDeployed
protected boolean directoryDeployed
-
showArchivedRealPathEnabled
protected boolean showArchivedRealPathEnabled
-
servletReloadCheckSecs
protected int servletReloadCheckSecs
-
directoryListing
protected boolean directoryListing
Should we generate directory listings?
-
-
Method Detail
-
getEncodedPath
public String getEncodedPath()
Description copied from interface:Context
Return the URL encoded context path, using UTF-8.- Specified by:
getEncodedPath
in interfaceContext
-
setName
public void setName(String name)
Description copied from class:ContainerBase
Set a name string (suitable for use by humans) that describes this Container. Within the set of child containers belonging to a particular parent, Container names must be unique.- Specified by:
setName
in interfaceContainer
- Overrides:
setName
in classContainerBase
- Parameters:
name
- New name of this container
-
isCachingAllowed
public boolean isCachingAllowed()
Is caching allowed ?
-
setCachingAllowed
public void setCachingAllowed(boolean cachingAllowed)
Set caching allowed flag.
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
Set case sensitivity.
-
isCaseSensitive
public boolean isCaseSensitive()
Is case sensitive ?
-
setCaseSensitiveMapping
public void setCaseSensitiveMapping(boolean caseSensitiveMap)
Set case sensitivity for filter and security constraint mappings.
-
isCaseSensitiveMapping
public boolean isCaseSensitiveMapping()
Are filters and security constraints mapped in a case sensitive manner?
-
setAllowLinking
public void setAllowLinking(boolean allowLinking)
Set allow linking.
-
isAllowLinking
public boolean isAllowLinking()
Is linking allowed.
-
setCacheTTL
public void setCacheTTL(int cacheTTL)
Set cache TTL.
-
getCacheTTL
public int getCacheTTL()
Get cache TTL.
-
getCacheMaxSize
public int getCacheMaxSize()
Return the maximum size of the cache in KB.
-
setCacheMaxSize
public void setCacheMaxSize(int cacheMaxSize)
Set the maximum size of the cache in KB.
-
getDelegate
public boolean getDelegate()
Return the "follow standard delegation model" flag used to configure our ClassLoader.
-
setDelegate
public void setDelegate(boolean delegate)
Set the "follow standard delegation model" flag used to configure our ClassLoader.- Parameters:
delegate
- The new flag
-
isUseNaming
public boolean isUseNaming()
Returns true if the internal naming support is used.
-
setUseNaming
public void setUseNaming(boolean useNaming)
Enables or disables naming.
-
isFilesystemBased
public boolean isFilesystemBased()
- Returns:
- true if the resources associated with this context are filesystem based, false otherwise
-
getApplicationEventListeners
public List<EventListener> getApplicationEventListeners()
- Specified by:
getApplicationEventListeners
in interfaceContext
- Returns:
- the list of initialized application event listeners of this application, in the order in which they have been specified in the deployment descriptor
-
getSessionListeners
public List<jakarta.servlet.http.HttpSessionListener> getSessionListeners()
-
getAvailable
public boolean getAvailable()
Return the application available flag for this Context.- Specified by:
getAvailable
in interfaceContext
-
setAvailable
public void setAvailable(boolean available)
Set the application available flag for this Context.- Specified by:
setAvailable
in interfaceContext
- Parameters:
available
- The new application available flag
-
getAntiJARLocking
public boolean getAntiJARLocking()
Return the antiJARLocking flag for this Context.
-
setAntiJARLocking
public void setAntiJARLocking(boolean antiJARLocking)
Set the antiJARLocking feature for this Context.- Parameters:
antiJARLocking
- The new flag value
-
getCharsetMapper
public CharsetMapper getCharsetMapper()
Return the Locale to character set mapper for this Context.- Specified by:
getCharsetMapper
in interfaceContext
-
setCharsetMapper
public void setCharsetMapper(CharsetMapper mapper)
Set the Locale to character set mapper for this Context.- Specified by:
setCharsetMapper
in interfaceContext
- Parameters:
mapper
- The new mapper
-
getRequestCharacterEncoding
public String getRequestCharacterEncoding()
- Specified by:
getRequestCharacterEncoding
in interfacejakarta.servlet.ServletContext
-
setRequestCharacterEncoding
public void setRequestCharacterEncoding(String encoding)
- Specified by:
setRequestCharacterEncoding
in interfacejakarta.servlet.ServletContext
-
getResponseCharacterEncoding
public String getResponseCharacterEncoding()
- Specified by:
getResponseCharacterEncoding
in interfacejakarta.servlet.ServletContext
-
setResponseCharacterEncoding
public void setResponseCharacterEncoding(String encoding)
- Specified by:
setResponseCharacterEncoding
in interfacejakarta.servlet.ServletContext
-
getConfigFile
public String getConfigFile()
Description copied from interface:Context
Return the path to a file to save this Context information.- Specified by:
getConfigFile
in interfaceContext
- Returns:
- the path to a file to save this Context information
-
setConfigFile
public void setConfigFile(String configFile)
Set the path to a file to save this Context information.- Specified by:
setConfigFile
in interfaceContext
- Parameters:
configFile
- The path to a file to save this Context information
-
getConfigured
public boolean getConfigured()
Description copied from interface:Context
Return the "correctly configured" flag for this Context.- Specified by:
getConfigured
in interfaceContext
- Returns:
- the "correctly configured" flag for this Context
-
setConfigured
public void setConfigured(boolean configured)
Sets the "correctly configured" flag for this Context. This can be set to false by startup listeners that detect a fatal configuration error to avoid the application from being made available.- Specified by:
setConfigured
in interfaceContext
- Parameters:
configured
- The new correctly configured flag
-
getCookies
public boolean getCookies()
Description copied from interface:Context
Return the "use cookies for session ids" flag.- Specified by:
getCookies
in interfaceContext
- Returns:
- the "use cookies for session ids" flag
-
setCookies
public void setCookies(boolean cookies)
Set the "use cookies for session ids" flag.- Specified by:
setCookies
in interfaceContext
- Parameters:
cookies
- The new flag
-
isEnableURLRewriting
public boolean isEnableURLRewriting()
Checks whether the rewriting of URLs with the jsessionids of HTTP sessions belonging to this context is enabled or not.- Specified by:
isEnableURLRewriting
in interfaceContext
- Returns:
- true if the rewriting of URLs with the jsessionids of HTTP sessions belonging to this context is enabled, false otherwise
-
setEnableURLRewriting
public void setEnableURLRewriting(boolean enableURLRewriting)
Enables or disables the rewriting of URLs with the jsessionids of HTTP sessions belonging to this context.- Specified by:
setEnableURLRewriting
in interfaceContext
- Parameters:
enableURLRewriting
- true if the rewriting of URLs with the jsessionids of HTTP sessions belonging to this context should be enabled, false otherwise
-
getCrossContext
public boolean getCrossContext()
Description copied from interface:Context
Return the "allow crossing servlet contexts" flag.- Specified by:
getCrossContext
in interfaceContext
- Returns:
- the "allow crossing servlet contexts" flag
-
setCrossContext
public void setCrossContext(boolean crossContext)
Sets the "allow crossing servlet contexts" flag.- Specified by:
setCrossContext
in interfaceContext
- Parameters:
crossContext
- The new cross contexts flag
-
getDefaultWebXml
public String getDefaultWebXml()
-
setDefaultWebXml
public void setDefaultWebXml(String defaultWebXml)
Set the location of the default web xml that will be used. If not absolute, it'll be made relative to the engine's base dir ( which defaults to catalina.base system property ). XXX If a file is not found - we can attempt a getResource()- Parameters:
defaultWebXml
-
-
getStartupTime
public long getStartupTime()
Gets the time (in milliseconds) it took to start this context.- Returns:
- Time (in milliseconds) it took to start this context.
-
setStartupTime
public void setStartupTime(long startupTime)
-
getTldScanTime
public long getTldScanTime()
-
setTldScanTime
public void setTldScanTime(long tldScanTime)
-
getDisplayName
public String getDisplayName()
Return the display name of this web application.- Specified by:
getDisplayName
in interfaceContext
-
getAltDDName
public String getAltDDName()
Return the alternate Deployment Descriptor name.- Specified by:
getAltDDName
in interfaceContext
-
setAltDDName
public void setAltDDName(String altDDName)
Set an alternate Deployment Descriptor name.- Specified by:
setAltDDName
in interfaceContext
-
getCompilerClasspath
public String getCompilerClasspath()
Return the compiler classpath.
-
setCompilerClasspath
public void setCompilerClasspath(String compilerClasspath)
Set the compiler classpath.
-
setDisplayName
public void setDisplayName(String displayName)
Set the display name of this web application.- Specified by:
setDisplayName
in interfaceContext
- Parameters:
displayName
- The new display name
-
getDistributable
public boolean getDistributable()
Return the distributable flag for this web application.- Specified by:
getDistributable
in interfaceContext
-
setDistributable
public void setDistributable(boolean distributable)
Set the distributable flag for this web application.- Specified by:
setDistributable
in interfaceContext
- Parameters:
distributable
- The new distributable flag
-
getDocBase
public String getDocBase()
Return the document root for this Context. This can be an absolute pathname, a relative pathname, or a URL.- Specified by:
getDocBase
in interfaceContext
-
setDocBase
public void setDocBase(String docBase)
Set the document root for this Context. This can be an absolute pathname, a relative pathname, or a URL.- Specified by:
setDocBase
in interfaceContext
- Parameters:
docBase
- The new document root
-
addAlternateDocBase
public void addAlternateDocBase(String urlPattern, String docBase)
Configures this context's alternate doc base mappings.- Parameters:
urlPattern
-docBase
-
-
getAlternateDocBases
public ArrayList<org.glassfish.grizzly.http.server.util.AlternateDocBase> getAlternateDocBases()
Gets this context's configured alternate doc bases.- Returns:
- This context's configured alternate doc bases
-
getManagerChecksFrequency
public int getManagerChecksFrequency()
Return the frequency of manager checks.
-
setManagerChecksFrequency
public void setManagerChecksFrequency(int managerChecksFrequency)
Set the manager checks frequency.- Parameters:
managerChecksFrequency
- the new manager checks frequency
-
getInfo
public String getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format<description>/<version>
.- Specified by:
getInfo
in interfaceContainer
- Overrides:
getInfo
in classContainerBase
-
setJvmRoute
public void setJvmRoute(String jvmRoute)
-
getJvmRoute
public String getJvmRoute()
-
getEngineName
public String getEngineName()
-
setEngineName
public void setEngineName(String engineName)
-
getJ2EEApplication
public String getJ2EEApplication()
-
setJ2EEApplication
public void setJ2EEApplication(String j2EEApplication)
-
getJ2EEServer
public String getJ2EEServer()
-
setJ2EEServer
public void setJ2EEServer(String j2EEServer)
-
getLoginConfig
public LoginConfig getLoginConfig()
Return the login configuration descriptor for this web application.- Specified by:
getLoginConfig
in interfaceContext
-
setLoginConfig
public void setLoginConfig(LoginConfig config)
Set the login configuration descriptor for this web application.- Specified by:
setLoginConfig
in interfaceContext
- Parameters:
config
- The new login configuration
-
getMapper
public org.glassfish.grizzly.http.server.util.Mapper getMapper()
Get the mapper associated with the context.
-
restrictedSetPipeline
public void restrictedSetPipeline(Pipeline pl)
Sets a new pipeline
-
getNamingResources
public NamingResources getNamingResources()
Return the naming resources associated with this web application.- Specified by:
getNamingResources
in interfaceContext
-
setNamingResources
public void setNamingResources(NamingResources namingResources)
Set the naming resources for this web application.- Specified by:
setNamingResources
in interfaceContext
- Parameters:
namingResources
- The new naming resources
-
getPath
public String getPath()
Return the context path for this Context.
-
setPath
public void setPath(String path)
Set the context path for this Context.IMPLEMENTATION NOTE: The context path is used as the "name" of a Context, because it must be unique.
-
getPublicId
public String getPublicId()
Return the public identifier of the deployment descriptor DTD that is currently being parsed.- Specified by:
getPublicId
in interfaceContext
-
setPublicId
public void setPublicId(String publicId)
Set the public identifier of the deployment descriptor DTD that is currently being parsed.- Specified by:
setPublicId
in interfaceContext
- Parameters:
publicId
- The public identifier
-
getReloadable
public boolean getReloadable()
Return the reloadable flag for this web application.- Specified by:
getReloadable
in interfaceContext
-
getOverride
public boolean getOverride()
Return the DefaultContext override flag for this web application.- Specified by:
getOverride
in interfaceContext
-
getOriginalDocBase
public String getOriginalDocBase()
Gets the original document root for this Context, which can be an absolute pathname, a relative pathname, or a URL. Is only set as deployment has change docRoot!
-
setOriginalDocBase
public void setOriginalDocBase(String docBase)
Set the original document root for this Context, which can be an absolute pathname, a relative pathname, or a URL.- Parameters:
docBase
- The original document root
-
getPrivileged
public boolean getPrivileged()
Return the privileged flag for this web application.- Specified by:
getPrivileged
in interfaceContext
-
setPrivileged
public void setPrivileged(boolean privileged)
Set the privileged flag for this web application.- Specified by:
setPrivileged
in interfaceContext
- Parameters:
privileged
- The new privileged flag
-
setReloadable
public void setReloadable(boolean reloadable)
Set the reloadable flag for this web application.- Specified by:
setReloadable
in interfaceContext
- Parameters:
reloadable
- The new reloadable flag
-
setOverride
public void setOverride(boolean override)
Set the DefaultContext override flag for this web application.- Specified by:
setOverride
in interfaceContext
- Parameters:
override
- The new override flag
-
isJsfApplication
public boolean isJsfApplication()
Scan the parent when searching for TLD listeners.- Specified by:
isJsfApplication
in interfaceContext
-
hasAdHocPaths
public boolean hasAdHocPaths()
Indicates whether this web module contains any ad-hoc paths. An ad-hoc path is a servlet path that is mapped to a servlet not declared in the web module's deployment descriptor. A web module all of whose mappings are for ad-hoc paths is called an ad-hoc web module.- Specified by:
hasAdHocPaths
in interfaceContext
- Returns:
- true if this web module contains any ad-hoc paths, false otherwise
-
getAdHocServletName
public String getAdHocServletName(String path)
Returns the name of the ad-hoc servlet responsible for servicing the given path.- Specified by:
getAdHocServletName
in interfaceContext
- Parameters:
path
- The path to service- Returns:
- The name of the ad-hoc servlet responsible for servicing the given path, or null if the given path is not an ad-hoc path
-
isReplaceWelcomeFiles
public boolean isReplaceWelcomeFiles()
Return the "replace welcome files" property.
-
setReplaceWelcomeFiles
public void setReplaceWelcomeFiles(boolean replaceWelcomeFiles)
Set the "replace welcome files" property.- Parameters:
replaceWelcomeFiles
- The new property value
-
isSecurePagesWithPragma
public boolean isSecurePagesWithPragma()
Returns the value of the securePagesWithPragma property.- Specified by:
isSecurePagesWithPragma
in interfaceContext
- Returns:
- true if Pragma and Cache-Control headers will be set to "No-cache" if proxy caching has been disabled; false otherwise.
-
setSecurePagesWithPragma
public void setSecurePagesWithPragma(boolean securePagesWithPragma)
Sets the securePagesWithPragma property of this Context. Setting this property to true will result in Pragma and Cache-Control headers with a value of "No-cache" if proxy caching has been disabled. Setting this property to false will not add any Pragma header, but will set the Cache-Control header to "private".- Specified by:
setSecurePagesWithPragma
in interfaceContext
- Parameters:
securePagesWithPragma
- true if Pragma and Cache-Control headers are to be set to "No-cache" if proxy caching has been disabled, false otherwise
-
setUseMyFaces
public void setUseMyFaces(boolean useMyFaces)
-
isUseMyFaces
public boolean isUseMyFaces()
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()
Return the servlet context for which this Context is a facade.- Specified by:
getServletContext
in interfaceContext
-
getSessionTimeout
public int getSessionTimeout()
Return the default session timeout (in minutes) for this web application.- Specified by:
getSessionTimeout
in interfaceContext
- Specified by:
getSessionTimeout
in interfacejakarta.servlet.ServletContext
-
isSessionTimeoutOveridden
public boolean isSessionTimeoutOveridden()
Is the session timeout (in minutes) for this web application over-ridden from the default HERCULES:add
-
setSessionTimeout
public void setSessionTimeout(int timeout)
Set the default session timeout (in minutes) for this web application.- Specified by:
setSessionTimeout
in interfaceContext
- Specified by:
setSessionTimeout
in interfacejakarta.servlet.ServletContext
- Parameters:
timeout
- The new default session timeout
-
getUnloadDelay
public long getUnloadDelay()
Return the value of the unloadDelay flag.
-
setUnloadDelay
public void setUnloadDelay(long unloadDelay)
Set the value of the unloadDelay flag, which represents the amount of ms that the container will wait when unloading servlets. Setting this to a small value may cause more requests to fail to complete when stopping a web application.- Parameters:
unloadDelay
- The new value
-
getUnpackWAR
public boolean getUnpackWAR()
Unpack WAR flag accessor.
-
setUnpackWAR
public void setUnpackWAR(boolean unpackWAR)
Unpack WAR flag mutator.
-
setResources
public void setResources(DirContext resources)
Set the resources DirContext object with which this Container is associated.- Specified by:
setResources
in interfaceContainer
- Overrides:
setResources
in classContainerBase
- Parameters:
resources
- The newly associated DirContext
-
getReuseSessionID
public boolean getReuseSessionID()
Return the "reuse session IDs when creating sessions" flag- Specified by:
getReuseSessionID
in interfaceContext
-
setReuseSessionID
public void setReuseSessionID(boolean reuse)
Set the "reuse session IDs when creating sessions" flag- Specified by:
setReuseSessionID
in interfaceContext
- Parameters:
reuse
- The new value for the flag
-
getAllowRelativeRedirect
public boolean getAllowRelativeRedirect()
Return whether this context allows sendRedirect() to redirect to a relative URL. The default value for this property is 'false'.- Specified by:
getAllowRelativeRedirect
in interfaceContext
-
setAllowRelativeRedirect
public void setAllowRelativeRedirect(boolean allowRelativeURLs)
Set whether this context allows sendRedirect() to redirect to a relative URL.- Specified by:
setAllowRelativeRedirect
in interfaceContext
- Parameters:
allowRelativeURLs
- The new value for this property. The default value for this property is 'false'.
-
getAuditors
public Auditor[] getAuditors()
Get Auditors associated with this context, if any.- Specified by:
getAuditors
in interfaceContext
- Returns:
- array of Auditor objects, or null
-
setAuditors
public void setAuditors(Auditor[] auditor)
Set the Auditors associated with this context.- Specified by:
setAuditors
in interfaceContext
- Parameters:
auditor
- array of Auditor objects
-
setReload
public void setReload(boolean isReload)
-
isReload
public boolean isReload()
-
setEmbedded
public void setEmbedded(boolean isEmbedded)
-
isEmbedded
public boolean isEmbedded()
-
setDirectoryListing
public void setDirectoryListing(boolean directoryListing)
Enables or disables directory listings on this Context.
-
isDirectoryListing
public boolean isDirectoryListing()
Checks whether directory listings are enabled or disabled on this Context.
-
getCharsetMapperClass
public String getCharsetMapperClass()
Return the Locale to character set mapper class for this Context.
-
setCharsetMapperClass
public void setCharsetMapperClass(String mapper)
Set the Locale to character set mapper class for this Context.- Parameters:
mapper
- The new mapper class
-
getWorkPath
public String getWorkPath()
Get the absolute path to the work dir.- Returns:
- the absolute path to the work dir
-
getWorkDir
public String getWorkDir()
Return the work directory for this Context.
-
setWorkDir
public void setWorkDir(String workDir)
Set the work directory for this Context.- Parameters:
workDir
- The new work directory
-
addApplicationListener
public void addApplicationListener(String listener)
Adds the Listener with the given class name that is declared in the deployment descriptor to the set of Listeners configured for this application.- Specified by:
addApplicationListener
in interfaceContext
- Parameters:
listener
- the fully qualified class name of the Listener
-
addApplicationParameter
public void addApplicationParameter(ApplicationParameter parameter)
Add a new application parameter for this application.- Specified by:
addApplicationParameter
in interfaceContext
- Parameters:
parameter
- The new application parameter
-
addChild
public void addChild(Container child)
Adds the given child Container to this context.- Specified by:
addChild
in interfaceContainer
- Overrides:
addChild
in classContainerBase
- Parameters:
child
- the child Container to add- Throws:
IllegalArgumentException
- if the given child Container is not an instance of Wrapper
-
addChild
protected void addChild(Container child, boolean isProgrammatic, boolean createRegistration)
Adds the given child (Servlet) to this context.- Parameters:
child
- the child (Servlet) to addisProgrammatic
- true if the given child (Servlet) is being added via one of the programmatic interfaces, and false if it is declared in the deployment descriptorcreateRegistration
- true if a ServletRegistration needs to be created for the given child, and false if a (preliminary) ServletRegistration had already been created (which would be the case if the Servlet had been declared in the deployment descriptor without any servlet-class, and the servlet-class was later provided via ServletContext#addServlet)- Throws:
IllegalArgumentException
- if the given child Container is not an instance of Wrapper
-
createServletRegistrationImpl
protected ServletRegistrationImpl createServletRegistrationImpl(StandardWrapper wrapper)
-
createDynamicServletRegistrationImpl
protected ServletRegistrationImpl createDynamicServletRegistrationImpl(StandardWrapper wrapper)
-
addConstraint
public void addConstraint(SecurityConstraint constraint)
Add a security constraint to the set for this web application.- Specified by:
addConstraint
in interfaceContext
-
addEjb
public void addEjb(ContextEjb ejb)
Add an EJB resource reference for this web application.
-
addEnvironment
public void addEnvironment(ContextEnvironment environment)
Add an environment entry for this web application.- Specified by:
addEnvironment
in interfaceContext
- Parameters:
environment
- New environment entry
-
addResourceParams
public void addResourceParams(ResourceParams resourceParameters)
Add resource parameters for this web application.- Parameters:
resourceParameters
- New resource parameters
-
addErrorPage
public void addErrorPage(ErrorPage errorPage)
Add an error page for the specified error or Java exception.- Specified by:
addErrorPage
in interfaceContext
- Parameters:
errorPage
- The error page definition to be added
-
addFilterDef
public void addFilterDef(FilterDef filterDef)
Add a filter definition to this Context.- Specified by:
addFilterDef
in interfaceContext
- Parameters:
filterDef
- The filter definition to be added
-
addFilterDef
public void addFilterDef(FilterDef filterDef, boolean isProgrammatic, boolean createRegistration)
Add a filter definition to this Context.- Parameters:
filterDef
- The filter definition to be addedisProgrammatic
-createRegistration
-
-
addFilterMaps
public void addFilterMaps(FilterMaps filterMaps)
Add multiple filter mappings to this Context.- Parameters:
filterMaps
- The filter mappings to be added- Throws:
IllegalArgumentException
- if the specified filter name does not match an existing filter definition, or the filter mapping is malformed
-
addFilterMap
public void addFilterMap(FilterMap filterMap)
Add a filter mapping to this Context.- Specified by:
addFilterMap
in interfaceContext
- Parameters:
filterMap
- The filter mapping to be added- Throws:
IllegalArgumentException
- if the specified filter name does not match an existing filter definition, or the filter mapping is malformed
-
addFilterMap
public void addFilterMap(FilterMap filterMap, boolean isMatchAfter)
Add a filter mapping to this Context.- Parameters:
filterMap
- The filter mapping to be addedisMatchAfter
- true if the given filter mapping should be matched against requests after any declared filter mappings of this servlet context, and false if it is supposed to be matched before any declared filter mappings of this servlet context- Throws:
IllegalArgumentException
- if the specified filter name does not match an existing filter definition, or the filter mapping is malformed
-
getServletNameFilterMappings
public Collection<String> getServletNameFilterMappings(String filterName)
Gets the current servlet name mappings of the Filter with the given name.
-
getUrlPatternFilterMappings
public Collection<String> getUrlPatternFilterMappings(String filterName)
Gets the current URL pattern mappings of the Filter with the given name.
-
addFilter
public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, String className)
Adds the filter with the given name and class name to this servlet context.- Specified by:
addFilter
in interfacejakarta.servlet.ServletContext
-
addFilter
public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, jakarta.servlet.Filter filter)
- Specified by:
addFilter
in interfacejakarta.servlet.ServletContext
-
hasFilter
public boolean hasFilter(jakarta.servlet.Filter filter)
Checks whether this context contains the given Filter instance
-
addFilter
public jakarta.servlet.FilterRegistration.Dynamic addFilter(String filterName, Class<? extends jakarta.servlet.Filter> filterClass)
Adds the filter with the given name and class type to this servlet context.- Specified by:
addFilter
in interfacejakarta.servlet.ServletContext
-
createFilter
public <T extends jakarta.servlet.Filter> T createFilter(Class<T> clazz) throws jakarta.servlet.ServletException
Instantiates the given Filter class and performs any required resource injection into the new Filter instance before returning it.- Specified by:
createFilter
in interfacejakarta.servlet.ServletContext
- Throws:
jakarta.servlet.ServletException
-
getFilterRegistration
public jakarta.servlet.FilterRegistration getFilterRegistration(String filterName)
Gets the FilterRegistration corresponding to the filter with the given filterName.- Specified by:
getFilterRegistration
in interfacejakarta.servlet.ServletContext
-
getFilterRegistrations
public Map<String,? extends jakarta.servlet.FilterRegistration> getFilterRegistrations()
Gets a Map of the FilterRegistration objects corresponding to all currently registered filters.- Specified by:
getFilterRegistrations
in interfacejakarta.servlet.ServletContext
-
getSessionCookieConfig
public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()
Gets the session tracking cookie configuration of this ServletContext.- Specified by:
getSessionCookieConfig
in interfaceContext
- Specified by:
getSessionCookieConfig
in interfacejakarta.servlet.ServletContext
- Returns:
- the session tracking cookie configuration of this ServletContext.
-
getSessionCookieName
public String getSessionCookieName()
Gets the name that will be assigned to any session tracking cookies created on behalf of this context- Specified by:
getSessionCookieName
in interfaceContext
- Returns:
- the name that will be assigned to any session tracking cookies created on behalf of this context
-
getSessionParameterName
public String getSessionParameterName()
- Specified by:
getSessionParameterName
in interfaceContext
- Returns:
- the name that will be assigned to any session tracking parameter created on behalf of this context
-
setSessionTrackingModes
public void setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> sessionTrackingModes)
Sets the session tracking modes that are to become effective for this ServletContext.- Specified by:
setSessionTrackingModes
in interfacejakarta.servlet.ServletContext
-
getDefaultSessionTrackingModes
public Set<jakarta.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
Gets the session tracking modes that are supported by default for this ServletContext.- Specified by:
getDefaultSessionTrackingModes
in interfacejakarta.servlet.ServletContext
- Returns:
- set of the session tracking modes supported by default for this ServletContext
-
getEffectiveSessionTrackingModes
public Set<jakarta.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
Gets the session tracking modes that are in effect for this ServletContext.- Specified by:
getEffectiveSessionTrackingModes
in interfacejakarta.servlet.ServletContext
- Returns:
- set of the session tracking modes in effect for this ServletContext
-
addListener
public void addListener(String className)
Adds the listener with the given class name to this ServletContext.- Specified by:
addListener
in interfacejakarta.servlet.ServletContext
- Parameters:
className
- the fully qualified class name of the listener
-
addListener
public <T extends EventListener> void addListener(T t)
Adds the given listener instance to this ServletContext.- Specified by:
addListener
in interfacejakarta.servlet.ServletContext
- Parameters:
t
- the listener to be added
-
addListener
public void addListener(Class<? extends EventListener> listenerClass)
Adds a listener of the given class type to this ServletContext.- Specified by:
addListener
in interfacejakarta.servlet.ServletContext
-
createListener
public <T extends EventListener> T createListener(Class<T> clazz) throws jakarta.servlet.ServletException
Instantiates the given EventListener class and performs any required resource injection into the new EventListener instance before returning it.- Specified by:
createListener
in interfacejakarta.servlet.ServletContext
- Throws:
jakarta.servlet.ServletException
-
setJspConfigDescriptor
public void setJspConfigDescriptor(jakarta.servlet.descriptor.JspConfigDescriptor jspConfigDesc)
-
getJspConfigDescriptor
public jakarta.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
Gets the<jsp-config>
related configuration that was aggregated over theweb.xml
andweb-fragment.xml
resources of the web application represented by this ServletContext.- Specified by:
getJspConfigDescriptor
in interfacejakarta.servlet.ServletContext
-
getClassLoader
public ClassLoader getClassLoader()
Gets the class loader of the web application represented by this ServletContext.- Specified by:
getClassLoader
in interfacejakarta.servlet.ServletContext
-
declareRoles
public void declareRoles(String... roleNames)
- Specified by:
declareRoles
in interfacejakarta.servlet.ServletContext
-
setEffectiveMajorVersion
public void setEffectiveMajorVersion(int effectiveMajorVersion)
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()
- Specified by:
getEffectiveMajorVersion
in interfacejakarta.servlet.ServletContext
-
setEffectiveMinorVersion
public void setEffectiveMinorVersion(int effectiveMinorVersion)
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()
- Specified by:
getEffectiveMinorVersion
in interfacejakarta.servlet.ServletContext
-
getVirtualServerName
public String getVirtualServerName()
- Specified by:
getVirtualServerName
in interfacejakarta.servlet.ServletContext
-
addInstanceListener
public void addInstanceListener(String listener)
Add the classname of an InstanceListener to be added to each Wrapper appended to this Context.- Specified by:
addInstanceListener
in interfaceContext
- Parameters:
listener
- Java class name of an InstanceListener class
-
addInstanceListener
public void addInstanceListener(InstanceListener listener)
-
addJspMapping
public void addJspMapping(String pattern)
Add the given URL pattern as a jsp-property-group. This maps resources that match the given pattern so they will be passed to the JSP container. Though there are other elements in the property group, we only care about the URL pattern here. The JSP container will parse the rest.- Specified by:
addJspMapping
in interfaceContext
- Parameters:
pattern
- URL pattern to be mapped
-
addLocaleEncodingMappingParameter
public void addLocaleEncodingMappingParameter(String locale, String encoding)
Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)- Specified by:
addLocaleEncodingMappingParameter
in interfaceContext
- Parameters:
locale
- locale to map an encoding forencoding
- encoding to be used for a give locale
-
addLocalEjb
public void addLocalEjb(ContextLocalEjb ejb)
Add a local EJB resource reference for this web application.- Specified by:
addLocalEjb
in interfaceContext
- Parameters:
ejb
- New EJB resource reference
-
addMessageDestination
public void addMessageDestination(MessageDestination md)
Add a message destination for this web application.- Parameters:
md
- New message destination
-
addMessageDestinationRef
public void addMessageDestinationRef(MessageDestinationRef mdr)
Add a message destination reference for this web application.- Parameters:
mdr
- New message destination reference
-
addMimeMapping
public void addMimeMapping(String extension, String mimeType)
Add a new MIME mapping, replacing any existing mapping for the specified extension.- Specified by:
addMimeMapping
in interfaceContext
- Parameters:
extension
- Filename extension being mappedmimeType
- Corresponding MIME type
-
addParameter
public void addParameter(String name, String value)
Add a new context initialization parameter.- Specified by:
addParameter
in interfaceContext
- Parameters:
name
- Name of the new parametervalue
- Value of the new parameter- Throws:
IllegalArgumentException
- if the name or value is missing, or if this context initialization parameter has already been registered
-
addResource
public void addResource(ContextResource resource)
Add a resource reference for this web application.- Specified by:
addResource
in interfaceContext
- Parameters:
resource
- New resource reference
-
addResourceEnvRef
public void addResourceEnvRef(String name, String type)
Add a resource environment reference for this web application.- Specified by:
addResourceEnvRef
in interfaceContext
- Parameters:
name
- The resource environment reference nametype
- The resource environment reference type
-
addResourceLink
public void addResourceLink(ContextResourceLink resourceLink)
Add a resource link for this web application.- Specified by:
addResourceLink
in interfaceContext
- Parameters:
resourceLink
- New resource link
-
addRoleMapping
public void addRoleMapping(String role, String link)
Add a security role reference for this web application.- Specified by:
addRoleMapping
in interfaceContext
- Parameters:
role
- Security role used in the applicationlink
- Actual security role to check for
-
addSecurityRole
public void addSecurityRole(String role)
Add a new security role for this web application.- Specified by:
addSecurityRole
in interfaceContext
- Parameters:
role
- New security role
-
addServletMapping
public Set<String> addServletMapping(ServletMap servletMap)
Adds the given servlet mappings to this Context.If any of the specified URL patterns are already mapped to a different Servlet, no updates will be performed.
- Parameters:
servletMap
- the Servlet mappings containing the Servlet name and URL patterns- Returns:
- the (possibly empty) Set of URL patterns that are already mapped to a different Servlet
- Throws:
IllegalArgumentException
- if the specified servlet name is not known to this Context
-
addServletMapping
public Set<String> addServletMapping(String name, String[] urlPatterns)
Adds the given servlet mappings to this Context.If any of the specified URL patterns are already mapped to a different Servlet, no updates will be performed.
- Parameters:
name
- the Servlet nameurlPatterns
- the URL patterns- Returns:
- the (possibly empty) Set of URL patterns that are already mapped to a different Servlet
- Throws:
IllegalArgumentException
- if the specified servlet name is not known to this Context
-
addServletMapping
public void addServletMapping(String pattern, String name)
Adds the given servlet mapping to this Context, overriding any existing mapping for the specified pattern.- Specified by:
addServletMapping
in interfaceContext
- Parameters:
pattern
- URL pattern to be mappedname
- Name of the corresponding servlet to execute- Throws:
IllegalArgumentException
- if the specified servlet name is not known to this Context
-
addServletMapping
public void addServletMapping(String pattern, String name, boolean jspWildCard)
Adds the given servlet mapping to this Context, overriding any existing mapping for the specified pattern.- Parameters:
pattern
- URL pattern to be mappedname
- Name of the corresponding servlet to executejspWildCard
- true if name identifies the JspServlet and pattern contains a wildcard; false otherwise- Throws:
IllegalArgumentException
- if the specified servlet name is not known to this Context
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, String className)
- Specified by:
addServlet
in interfacejakarta.servlet.ServletContext
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, jakarta.servlet.Servlet servlet)
- Specified by:
addServlet
in interfacejakarta.servlet.ServletContext
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, Class<? extends jakarta.servlet.Servlet> servletClass)
- Specified by:
addServlet
in interfacejakarta.servlet.ServletContext
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, jakarta.servlet.Servlet instance, Map<String,String> initParams)
Adds the given servlet instance with the given name to this servlet context and initializes it.In order to add any URL patterns that will be mapped to the given servlet, addServletMappings must be used. If this context has already been started, the URL patterns must be passed to addServlet instead.
- Specified by:
addServlet
in interfaceContext
- Parameters:
servletName
- the servlet nameinstance
- the servlet instanceinitParams
- Map containing the initialization parameters for the servlet- Returns:
- the ServletRegistration through which the servlet may be further configured
- Throws:
jakarta.servlet.ServletException
- if the servlet fails to be initialized
-
addServlet
public jakarta.servlet.ServletRegistration.Dynamic addServlet(String servletName, jakarta.servlet.Servlet servlet, Map<String,String> initParams, String... urlPatterns)
Adds the given servlet instance with the given name and URL patterns to this servlet context, and initializes it.- Specified by:
addServlet
in interfaceContext
- Parameters:
servletName
- the servlet nameservlet
- the servlet instanceinitParams
- Map containing the initialization parameters for the servleturlPatterns
- the URL patterns that will be mapped to the servlet- Returns:
- the ServletRegistration through which the servlet may be further configured
-
addJspFile
public jakarta.servlet.ServletRegistration.Dynamic addJspFile(String servletName, String jspFile)
- Specified by:
addJspFile
in interfacejakarta.servlet.ServletContext
-
removePatternFromServlet
protected void removePatternFromServlet(Wrapper wrapper, String pattern)
This method is overridden in web-glue to also remove the given mapping from the deployment backend's WebBundleDescriptor.
-
hasServlet
public boolean hasServlet(jakarta.servlet.Servlet servlet)
Checks whether this context contains the given Servlet instance- Parameters:
servlet
-- Returns:
-
createServlet
public <T extends jakarta.servlet.Servlet> T createServlet(Class<T> clazz) throws jakarta.servlet.ServletException
Instantiates the given Servlet class and performs any required resource injection into the new Servlet instance before returning it.- Specified by:
createServlet
in interfacejakarta.servlet.ServletContext
- Throws:
jakarta.servlet.ServletException
-
getServletRegistration
public jakarta.servlet.ServletRegistration getServletRegistration(String servletName)
Gets the ServletRegistration corresponding to the servlet with the given servletName.- Specified by:
getServletRegistration
in interfacejakarta.servlet.ServletContext
- Parameters:
servletName
-
-
getServletRegistrations
public Map<String,? extends jakarta.servlet.ServletRegistration> getServletRegistrations()
Gets a Map of the ServletRegistration objects corresponding to all currently registered servlets.- Specified by:
getServletRegistrations
in interfacejakarta.servlet.ServletContext
-
addWatchedResource
public void addWatchedResource(String name)
Add a new watched resource to the set recognized by this Context.- Specified by:
addWatchedResource
in interfaceContext
- Parameters:
name
- New watched resource file name
-
addWelcomeFile
public void addWelcomeFile(String name)
Add a new welcome file to the set recognized by this Context.- Specified by:
addWelcomeFile
in interfaceContext
- Parameters:
name
- New welcome file name
-
addWrapperLifecycle
public void addWrapperLifecycle(String listener)
Add the classname of a LifecycleListener to be added to each Wrapper appended to this Context.- Specified by:
addWrapperLifecycle
in interfaceContext
- Parameters:
listener
- Java class name of a LifecycleListener class
-
addWrapperListener
public void addWrapperListener(String listener)
Add the classname of a ContainerListener to be added to each Wrapper appended to this Context.- Specified by:
addWrapperListener
in interfaceContext
- Parameters:
listener
- Java class name of a ContainerListener class
-
createWrapper
public Wrapper createWrapper()
Factory method to create and return a new Wrapper instance, of the Java implementation class appropriate for this Context implementation. The constructor of the instantiated Wrapper will have been called, but no properties will have been set.- Specified by:
createWrapper
in interfaceContext
- Returns:
-
findApplicationParameters
public List<ApplicationParameter> findApplicationParameters()
Return the set of application parameters for this application.- Specified by:
findApplicationParameters
in interfaceContext
- Returns:
-
getConstraints
public List<SecurityConstraint> getConstraints()
Gets the security constraints defined for this web application.- Specified by:
getConstraints
in interfaceContext
- Returns:
-
hasConstraints
public boolean hasConstraints()
Checks whether this web application has any security constraints defined.- Specified by:
hasConstraints
in interfaceContext
- Returns:
-
findEjb
public ContextEjb findEjb(String name)
Return the EJB resource reference with the specified name, if any; otherwise, returnnull
.
-
findEjbs
public ContextEjb[] findEjbs()
Return the defined EJB resource references for this application. If there are none, a zero-length array is returned.
-
findEnvironment
public ContextEnvironment findEnvironment(String name)
Return the environment entry with the specified name, if any; otherwise, returnnull
.- Specified by:
findEnvironment
in interfaceContext
- Parameters:
name
- Name of the desired environment entry- Returns:
-
findEnvironments
public ContextEnvironment[] findEnvironments()
Return the set of defined environment entries for this web application. If none have been defined, a zero-length array is returned.- Specified by:
findEnvironments
in interfaceContext
- Returns:
-
findErrorPage
public ErrorPage findErrorPage(int errorCode)
Return the error page entry for the specified HTTP error code, if any; otherwise returnnull
.- Specified by:
findErrorPage
in interfaceContext
- Parameters:
errorCode
- Error code to look up- Returns:
-
findErrorPage
public ErrorPage findErrorPage(String exceptionType)
Return the error page entry for the specified Java exception type, if any; otherwise returnnull
.- Specified by:
findErrorPage
in interfaceContext
- Parameters:
exceptionType
- Exception type to look up- Returns:
-
getDefaultErrorPage
public ErrorPage getDefaultErrorPage()
Gets the default error page of this context.A default error page is an error page that was declared without any exception-type and error-code.
- Specified by:
getDefaultErrorPage
in interfaceContext
- Returns:
- the default error page of this context, or null if this context does not have any default error page
-
findFilterDef
public FilterDef findFilterDef(String filterName)
Return the filter definition for the specified filter name, if any; otherwise returnnull
.- Specified by:
findFilterDef
in interfaceContext
- Parameters:
filterName
- Filter name to look up- Returns:
-
findFilterDefs
public FilterDef[] findFilterDefs()
Return the set of defined filters for this Context.- Specified by:
findFilterDefs
in interfaceContext
-
findFilterMaps
public List<FilterMap> findFilterMaps()
Return the list of filter mappings for this Context.- Specified by:
findFilterMaps
in interfaceContext
- Returns:
-
findInstanceListeners
public List<String> findInstanceListeners()
Return the list of InstanceListener classes that will be added to newly created Wrappers automatically.- Specified by:
findInstanceListeners
in interfaceContext
-
findLocalEjb
public ContextLocalEjb findLocalEjb(String name)
Return the local EJB resource reference with the specified name, if any; otherwise, returnnull
.- Specified by:
findLocalEjb
in interfaceContext
- Parameters:
name
- Name of the desired EJB resource reference
-
findLocalEjbs
public ContextLocalEjb[] findLocalEjbs()
Return the defined local EJB resource references for this application. If there are none, a zero-length array is returned.- Specified by:
findLocalEjbs
in interfaceContext
-
findMappingObject
public Context findMappingObject()
FIXME: Fooling introspection ...
-
findMessageDestination
public MessageDestination findMessageDestination(String name)
Return the message destination with the specified name, if any; otherwise, returnnull
.- Parameters:
name
- Name of the desired message destination
-
findMessageDestinations
public MessageDestination[] findMessageDestinations()
Return the set of defined message destinations for this web application. If none have been defined, a zero-length array is returned.
-
findMessageDestinationRef
public MessageDestinationRef findMessageDestinationRef(String name)
Return the message destination ref with the specified name, if any; otherwise, returnnull
.- Parameters:
name
- Name of the desired message destination ref
-
findMessageDestinationRefs
public MessageDestinationRef[] findMessageDestinationRefs()
Return the set of defined message destination refs for this web application. If none have been defined, a zero-length array is returned.
-
findMimeMapping
public String findMimeMapping(String extension)
Return the MIME type to which the specified extension is mapped, if any; otherwise returnnull
.- Specified by:
findMimeMapping
in interfaceContext
- Parameters:
extension
- Extension to map to a MIME type
-
findMimeMappings
public String[] findMimeMappings()
Return the extensions for which MIME mappings are defined. If there are none, a zero-length array is returned.- Specified by:
findMimeMappings
in interfaceContext
-
findParameter
public String findParameter(String name)
Return the value for the specified context initialization parameter name, if any; otherwise returnnull
.- Specified by:
findParameter
in interfaceContext
- Parameters:
name
- Name of the parameter to return
-
findParameters
public String[] findParameters()
Return the names of all defined context initialization parameters for this Context. If no parameters are defined, a zero-length array is returned.- Specified by:
findParameters
in interfaceContext
-
findResource
public ContextResource findResource(String name)
Return the resource reference with the specified name, if any; otherwise returnnull
.- Specified by:
findResource
in interfaceContext
- Parameters:
name
- Name of the desired resource reference
-
findResourceEnvRef
public String findResourceEnvRef(String name)
Return the resource environment reference type for the specified name, if any; otherwise returnnull
.- Specified by:
findResourceEnvRef
in interfaceContext
- Parameters:
name
- Name of the desired resource environment reference
-
findResourceEnvRefs
public String[] findResourceEnvRefs()
Return the set of resource environment reference names for this web application. If none have been specified, a zero-length array is returned.- Specified by:
findResourceEnvRefs
in interfaceContext
-
findResourceLink
public ContextResourceLink findResourceLink(String name)
Return the resource link with the specified name, if any; otherwise returnnull
.- Specified by:
findResourceLink
in interfaceContext
- Parameters:
name
- Name of the desired resource link
-
findResourceLinks
public ContextResourceLink[] findResourceLinks()
Return the defined resource links for this application. If none have been defined, a zero-length array is returned.- Specified by:
findResourceLinks
in interfaceContext
-
findResources
public ContextResource[] findResources()
Return the defined resource references for this application. If none have been defined, a zero-length array is returned.- Specified by:
findResources
in interfaceContext
-
findRoleMapping
public String findRoleMapping(String role)
For the given security role (as used by an application), return the corresponding role name (as defined by the underlying Realm) if there is one. Otherwise, return the specified role unchanged.- Specified by:
findRoleMapping
in interfaceContext
- Parameters:
role
- Security role to map
-
hasSecurityRole
public boolean hasSecurityRole(String role)
Checks if the given security role is defined for this application.- Specified by:
hasSecurityRole
in interfaceContext
- Parameters:
role
- Security role to check for- Returns:
- true if the specified security role is defined for this application, false otherwise
-
removeSecurityRoles
public void removeSecurityRoles()
Removes any security roles defined for this application.- Specified by:
removeSecurityRoles
in interfaceContext
-
findServletMapping
public String findServletMapping(String pattern)
Return the servlet name mapped by the specified pattern (if any); otherwise returnnull
.- Specified by:
findServletMapping
in interfaceContext
- Parameters:
pattern
- Pattern for which a mapping is requested
-
findServletMappings
public String[] findServletMappings()
Return the patterns of all defined servlet mappings for this Context. If no mappings are defined, a zero-length array is returned.- Specified by:
findServletMappings
in interfaceContext
-
findStatusPage
public ErrorPage findStatusPage(int status)
Return the context-relative URI of the error page for the specified HTTP status code, if any; otherwise returnnull
.- Specified by:
findStatusPage
in interfaceContext
- Parameters:
status
- HTTP status code to look up
-
findStatusPages
public int[] findStatusPages()
Return the set of HTTP status codes for which error pages have been specified. If none are specified, a zero-length array is returned.- Specified by:
findStatusPages
in interfaceContext
-
findWelcomeFile
public boolean findWelcomeFile(String name)
Returntrue
if the specified welcome file is defined for this Context; otherwise returnfalse
.- Specified by:
findWelcomeFile
in interfaceContext
- Parameters:
name
- Welcome file to verify
-
getWatchedResources
public List<String> getWatchedResources()
Gets the watched resources defined for this web application.- Specified by:
getWatchedResources
in interfaceContext
-
findWelcomeFiles
public String[] findWelcomeFiles()
Return the set of welcome files defined for this Context. If none are defined, a zero-length array is returned.- Specified by:
findWelcomeFiles
in interfaceContext
-
findWrapperLifecycles
public List<String> findWrapperLifecycles()
Return the list of LifecycleListener classes that will be added to newly created Wrappers automatically.- Specified by:
findWrapperLifecycles
in interfaceContext
-
findWrapperListeners
public List<String> findWrapperListeners()
Return the list of ContainerListener classes that will be added to newly created Wrappers automatically.- Specified by:
findWrapperListeners
in interfaceContext
-
getAuthenticator
public Authenticator getAuthenticator()
Gets the Authenticator of this Context.- Specified by:
getAuthenticator
in interfaceContext
- Returns:
- the Authenticator of this Context
-
reload
public void reload()
Reload this web application, if reloading is supported.IMPLEMENTATION NOTE: This method is designed to deal with reloads required by changes to classes in the underlying repositories of our class loader. It does not handle changes to the web application deployment descriptor. If that has occurred, you should stop this Context and create (and start) a new Context instance instead.
- Specified by:
reload
in interfaceContext
- Throws:
IllegalStateException
- if thereloadable
property is set tofalse
.
-
removeApplicationParameter
public void removeApplicationParameter(String name)
Remove the application parameter with the specified name from the set for this application.- Specified by:
removeApplicationParameter
in interfaceContext
- Parameters:
name
- Name of the application parameter to remove
-
removeChild
public void removeChild(Container child)
Removes the given child container.- Specified by:
removeChild
in interfaceContainer
- Overrides:
removeChild
in classContainerBase
- Parameters:
child
- the child container to be removed- Throws:
IllegalArgumentException
- if the given child container is not an implementation of Wrapper
-
removeConstraints
public void removeConstraints()
Removes any security constraints from this web application.- Specified by:
removeConstraints
in interfaceContext
-
removeEjb
public void removeEjb(String name)
Remove any EJB resource reference with the specified name.
-
removeEnvironment
public void removeEnvironment(String name)
Remove any environment entry with the specified name.- Specified by:
removeEnvironment
in interfaceContext
- Parameters:
name
- Name of the environment entry to remove
-
removeErrorPages
public void removeErrorPages()
Removes any error page declarations.- Specified by:
removeErrorPages
in interfaceContext
-
removeFilterDef
public void removeFilterDef(FilterDef filterDef)
Remove the specified filter definition from this Context, if it exists; otherwise, no action is taken.- Specified by:
removeFilterDef
in interfaceContext
- Parameters:
filterDef
- Filter definition to be removed
-
removeFilterMaps
public void removeFilterMaps()
Removes any filter mappings from this Context.- Specified by:
removeFilterMaps
in interfaceContext
-
removeInstanceListener
public void removeInstanceListener(String listener)
Remove a class name from the list of InstanceListener classes that will be added to newly created Wrappers.- Specified by:
removeInstanceListener
in interfaceContext
- Parameters:
listener
- Class name of an InstanceListener class to be removed
-
removeLocalEjb
public void removeLocalEjb(String name)
Remove any local EJB resource reference with the specified name.- Specified by:
removeLocalEjb
in interfaceContext
- Parameters:
name
- Name of the EJB resource reference to remove
-
removeMessageDestination
public void removeMessageDestination(String name)
Remove any message destination with the specified name.- Parameters:
name
- Name of the message destination to remove
-
removeMessageDestinationRef
public void removeMessageDestinationRef(String name)
Remove any message destination ref with the specified name.- Parameters:
name
- Name of the message destination ref to remove
-
removeMimeMapping
public void removeMimeMapping(String extension)
Remove the MIME mapping for the specified extension, if it exists; otherwise, no action is taken.- Specified by:
removeMimeMapping
in interfaceContext
- Parameters:
extension
- Extension to remove the mapping for
-
removeParameter
public void removeParameter(String name)
Remove the context initialization parameter with the specified name, if it exists; otherwise, no action is taken.- Specified by:
removeParameter
in interfaceContext
- Parameters:
name
- Name of the parameter to remove
-
removeResource
public void removeResource(String resourceName)
Remove any resource reference with the specified name.- Specified by:
removeResource
in interfaceContext
- Parameters:
resourceName
- Name of the resource reference to remove
-
removeResourceEnvRef
public void removeResourceEnvRef(String name)
Remove any resource environment reference with the specified name.- Specified by:
removeResourceEnvRef
in interfaceContext
- Parameters:
name
- Name of the resource environment reference to remove
-
removeResourceLink
public void removeResourceLink(String link)
Remove any resource link with the specified name.- Specified by:
removeResourceLink
in interfaceContext
- Parameters:
link
- Name of the resource link to remove
-
removeRoleMapping
public void removeRoleMapping(String role)
Remove any security role reference for the specified name- Specified by:
removeRoleMapping
in interfaceContext
- Parameters:
role
- Security role (as used in the application) to remove
-
removeServletMapping
public void removeServletMapping(String pattern)
Remove any servlet mapping for the specified pattern, if it exists; otherwise, no action is taken.- Specified by:
removeServletMapping
in interfaceContext
- Parameters:
pattern
- URL pattern of the mapping to remove
-
hasWatchedResources
public boolean hasWatchedResources()
Checks whether this web application has any watched resources defined.- Specified by:
hasWatchedResources
in interfaceContext
-
removeWatchedResources
public void removeWatchedResources()
Clears any watched resources defined for this web application.- Specified by:
removeWatchedResources
in interfaceContext
-
removeWelcomeFiles
public void removeWelcomeFiles()
- Specified by:
removeWelcomeFiles
in interfaceContext
-
removeWrapperLifecycles
public void removeWrapperLifecycles()
Description copied from interface:Context
Removes any Wrapper lifecycle listeners from this Context- Specified by:
removeWrapperLifecycles
in interfaceContext
-
removeWrapperListeners
public void removeWrapperListeners()
Description copied from interface:Context
Removes any Wrapper listeners from this Context- Specified by:
removeWrapperListeners
in interfaceContext
-
fireRequestInitializedEvent
public void fireRequestInitializedEvent(jakarta.servlet.ServletRequest request)
Description copied from interface:Context
Notifies all ServletRequestListener instances configured for this Context of the requestInitialized event.- Specified by:
fireRequestInitializedEvent
in interfaceContext
-
fireRequestDestroyedEvent
public void fireRequestDestroyedEvent(jakarta.servlet.ServletRequest request)
Description copied from interface:Context
Notifies all ServletRequestListener instances configured for this Context of the requestDestroyed event.- Specified by:
fireRequestDestroyedEvent
in interfaceContext
-
filterStart
public boolean filterStart()
Configure and initialize the set of filters for this Context. Returntrue
if all filter initialization completed successfully, orfalse
otherwise.
-
filterStop
public boolean filterStop()
Finalize and release the set of filters for this Context. Returntrue
if all filter finalization completed successfully, orfalse
otherwise.
-
findFilterConfig
public jakarta.servlet.FilterConfig findFilterConfig(String name)
Find and return the initializedFilterConfig
for the specified filter name, if any; otherwise returnnull
.- Parameters:
name
- Name of the desired filter
-
contextListenerStart
protected void contextListenerStart()
Notifies all ServletContextListeners at their contextInitialized method.
-
loadListener
protected EventListener loadListener(ClassLoader loader, String listenerClassName) throws Exception
Loads and instantiates the listener with the specified classname.- Parameters:
loader
- the classloader to uselistenerClassName
- the fully qualified classname to instantiate- Returns:
- the instantiated listener
- Throws:
Exception
- if the specified classname fails to be loaded or instantiated
-
resourcesStart
public boolean resourcesStart()
Allocate resources, including proxy. Returntrue
if initialization was successfull, orfalse
otherwise.
-
alternateResourcesStart
public void alternateResourcesStart() throws LifecycleException
Starts this context's alternate doc base resources.- Throws:
LifecycleException
-
resourcesStop
public boolean resourcesStop()
Deallocate resources and destroy proxy.
-
alternateResourcesStop
public boolean alternateResourcesStop()
Stops this context's alternate doc base resources.
-
loadOnStartup
public void loadOnStartup(Container[] children) throws LifecycleException
Load and initialize all servlets marked "load on startup" in the web application deployment descriptor.- Parameters:
children
- Array of wrappers for all currently defined servlets (including those not declared load on startup)- Throws:
LifecycleException
-
managerStart
protected void managerStart() throws LifecycleException
Starts the session manager of this Context.- Throws:
LifecycleException
-
managerStop
protected void managerStop() throws LifecycleException
Stops the session manager of this Context.- Throws:
LifecycleException
-
start
public void start() throws LifecycleException
Start this Context component.- Specified by:
start
in interfaceLifecycle
- Overrides:
start
in classContainerBase
- Throws:
LifecycleException
- if a startup error occurs
-
getTypes
protected org.glassfish.hk2.classmodel.reflect.Types getTypes()
-
isStandalone
protected boolean isStandalone()
-
callServletContainerInitializers
protected void callServletContainerInitializers() throws LifecycleException
- Throws:
LifecycleException
-
setServletContainerInitializerInterestList
public void setServletContainerInitializerInterestList(Iterable<jakarta.servlet.ServletContainerInitializer> initializers)
-
createLoader
public void createLoader()
Creates a classloader for this context.
-
stop
public void stop() throws LifecycleException
Stop this Context component.- Specified by:
stop
in interfaceLifecycle
- Overrides:
stop
in classContainerBase
- Throws:
LifecycleException
- if a shutdown error occurs
-
stop
public void stop(boolean isShutdown) throws LifecycleException
Stop this Context component.- Parameters:
isShutdown
- true if this Context is being stopped as part of a domain shutdown (as opposed to an undeployment), and false otherwise- Throws:
LifecycleException
- if a shutdown error occurs
-
destroy
public void destroy() throws Exception
Destroys this context by cleaning it up completely. The problem is that undoing all the config in start() and restoring a 'fresh' state is impossible. After stop()/destroy()/init()/start() we should have the same state as if a fresh start was done - i.e read modified web.xml, etc. This can only be done by completely removing the context object and remapping a new one, or by cleaning up everything. XXX Should this be done in stop() ?- Overrides:
destroy
in classContainerBase
- Throws:
Exception
-
toString
public String toString()
Return a String representation of this component.
-
backgroundProcess
public void backgroundProcess()
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.- Specified by:
backgroundProcess
in interfaceContainer
- Overrides:
backgroundProcess
in classContainerBase
-
adjustURLPattern
protected String adjustURLPattern(String urlPattern)
Adjust the URL pattern to begin with a leading slash, if appropriate (i.e. we are running a servlet 2.2 application). Otherwise, return the specified URL pattern unchanged.- Parameters:
urlPattern
- The URL pattern to be adjusted (if needed) and returned
-
isServlet22
protected boolean isServlet22()
Are we processing a version 2.2 deployment descriptor?
-
engineBase
protected File engineBase()
Return a File object representing the base directory for the entire servlet container (i.e. the Engine container if present).
-
getDefaultConfigFile
protected String getDefaultConfigFile()
Given a context path, get the config file name.
-
getNamingContextName
public String getNamingContextName()
Get naming context full name.
-
getPaused
public boolean getPaused()
- Returns:
- the request processing paused flag for this Context
-
getHostname
public String getHostname()
-
validateURLPattern
protected boolean validateURLPattern(String urlPattern)
Validate the syntax of a proposed<url-pattern>
for conformance with specification requirements.- Parameters:
urlPattern
- URL pattern to be validated
-
getEnvironments
public String[] getEnvironments()
Return the MBean Names of the set of defined environment entries for this web application
-
getResourceNames
public String[] getResourceNames()
Return the MBean Names of all the defined resource references for this application.
-
getResourceLinks
public String[] getResourceLinks()
Return the MBean Names of all the defined resource links for this application
-
addEnvironment
public String addEnvironment(String envName, String type) throws MalformedObjectNameException
Add an environment entry for this web application.- Parameters:
envName
- New environment entry name- Throws:
MalformedObjectNameException
-
addResource
public String addResource(String resourceName, String type) throws MalformedObjectNameException
Add a resource reference for this web application.- Parameters:
resourceName
- New resource reference name- Throws:
MalformedObjectNameException
-
addResourceLink
public String addResourceLink(String resourceLinkName, String global, String name, String type) throws MalformedObjectNameException
Add a resource link for this web application.- Parameters:
resourceLinkName
- New resource link name- Throws:
MalformedObjectNameException
-
createObjectName
public ObjectName createObjectName(String hostDomain, ObjectName parentName) throws MalformedObjectNameException
- Overrides:
createObjectName
in classContainerBase
- Throws:
MalformedObjectNameException
-
sendNotification
public void sendNotification(Notification notification)
-
init
public void init() throws Exception
Description copied from class:ContainerBase
Init method, part of the MBean lifecycle. If the container was added via JMX, it'll register itself with the parent, using the ObjectName conventions to locate the parent. If the container was added directly and it doesn't have an ObjectName, it'll create a name and register itself with the JMX console. On destroy(), the object will unregister.- Overrides:
init
in classContainerBase
- Throws:
Exception
-
getParentName
public ObjectName getParentName() throws MalformedObjectNameException
Description copied from class:ContainerBase
Gets the name of the parent container- Overrides:
getParentName
in classContainerBase
- Returns:
- null if no parent
- Throws:
MalformedObjectNameException
-
createObjectName
public ObjectName createObjectName(ContextEnvironment environment) throws MalformedObjectNameException
Create anObjectName
forContextEnvironment
object.- Parameters:
environment
- The ContextEnvironment to be named- Throws:
MalformedObjectNameException
- if a name cannot be created
-
createObjectName
public ObjectName createObjectName(ContextResource resource) throws MalformedObjectNameException
Create anObjectName
forContextResource
object.- Parameters:
resource
- The ContextResource to be named- Throws:
MalformedObjectNameException
- if a name cannot be created
-
createObjectName
public ObjectName createObjectName(ContextResourceLink resourceLink) throws MalformedObjectNameException
Create anObjectName
forContextResourceLink
object.- Parameters:
resourceLink
- The ContextResourceLink to be named- Throws:
MalformedObjectNameException
- if a name cannot be created
-
getAttribute
public Object getAttribute(String name)
Return the value of the specified context attribute, if any; otherwise returnnull
.- Specified by:
getAttribute
in interfacejakarta.servlet.ServletContext
-
getAttributeNames
public Enumeration<String> getAttributeNames()
Return an enumeration of the names of the context attributes associated with this context.- Specified by:
getAttributeNames
in interfacejakarta.servlet.ServletContext
-
getContextPath
public String getContextPath()
Returns the context path of the web application.- Specified by:
getContextPath
in interfacejakarta.servlet.ServletContext
-
getContext
public jakarta.servlet.ServletContext getContext(String uri)
Return aServletContext
object that corresponds to a specified URI on the server.- Specified by:
getContext
in interfacejakarta.servlet.ServletContext
-
getInitParameter
public String getInitParameter(String name)
Return the value of the specified initialization parameter, ornull
if this parameter does not exist.- Specified by:
getInitParameter
in interfacejakarta.servlet.ServletContext
-
getInitParameterNames
public Enumeration<String> getInitParameterNames()
Return the names of the context's initialization parameters, or an empty enumeration if the context has no initialization parameters.- Specified by:
getInitParameterNames
in interfacejakarta.servlet.ServletContext
-
setInitParameter
public boolean setInitParameter(String name, String value)
- Specified by:
setInitParameter
in interfacejakarta.servlet.ServletContext
- Returns:
- true if the context initialization parameter with the given name and value was set successfully on this ServletContext, and false if it was not set because this ServletContext already contains a context initialization parameter with a matching name
-
getMajorVersion
public int getMajorVersion()
Return the major version of the Java Servlet API that we implement.- Specified by:
getMajorVersion
in interfacejakarta.servlet.ServletContext
-
getMinorVersion
public int getMinorVersion()
Return the minor version of the Java Servlet API that we implement.- Specified by:
getMinorVersion
in interfacejakarta.servlet.ServletContext
-
getMimeType
public String getMimeType(String file)
Return the MIME type of the specified file, ornull
if the MIME type cannot be determined.- Specified by:
getMimeType
in interfacejakarta.servlet.ServletContext
-
getNamedDispatcher
public jakarta.servlet.RequestDispatcher getNamedDispatcher(String name)
Return aRequestDispatcher
object that acts as a wrapper for the named servlet.- Specified by:
getNamedDispatcher
in interfacejakarta.servlet.ServletContext
-
getServletContextName
public String getServletContextName()
Return the display name of this web application.- Specified by:
getServletContextName
in interfacejakarta.servlet.ServletContext
-
removeAttribute
public void removeAttribute(String name)
Remove the context attribute with the specified name, if any.- Specified by:
removeAttribute
in interfacejakarta.servlet.ServletContext
-
setAttribute
public void setAttribute(String name, Object value)
Bind the specified value with the specified context attribute name, replacing any existing value for that name.- Specified by:
setAttribute
in interfacejakarta.servlet.ServletContext
-
getServerInfo
public String getServerInfo()
Return the name and version of the servlet container.- Specified by:
getServerInfo
in interfacejakarta.servlet.ServletContext
-
getRealPath
public String getRealPath(String path)
Return the real path corresponding to the given virtual path, ornull
if the container was unable to perform the translation- Specified by:
getRealPath
in interfacejakarta.servlet.ServletContext
-
log
public void log(String message)
Writes the specified message to a servlet log file.- Specified by:
log
in interfacejakarta.servlet.ServletContext
- Overrides:
log
in classContainerBase
- Parameters:
message
- Message to be logged
-
log
public void log(String message, Throwable throwable)
Writes the specified message and exception to a servlet log file.- Specified by:
log
in interfacejakarta.servlet.ServletContext
- Overrides:
log
in classContainerBase
- Parameters:
message
- Message to be loggedthrowable
- Related exception
-
getResourceAsStream
public InputStream getResourceAsStream(String path)
Return the requested resource as anInputStream
. The path must be specified according to the rules described undergetResource
. If no such resource can be identified, returnnull
.- Specified by:
getResourceAsStream
in interfacejakarta.servlet.ServletContext
-
getResource
public URL getResource(String path) throws MalformedURLException
Return the URL to the resource that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root.- Specified by:
getResource
in interfacejakarta.servlet.ServletContext
- Throws:
MalformedURLException
-
getResourcePaths
public Set<String> getResourcePaths(String path)
Return a Set containing the resource paths of resources member of the specified collection. Each path will be a String starting with a "/" character. The returned set is immutable.- Specified by:
getResourcePaths
in interfacejakarta.servlet.ServletContext
-
getRequestDispatcher
public jakarta.servlet.RequestDispatcher getRequestDispatcher(String path)
Return aRequestDispatcher
instance that acts as a wrapper for the resource at the given path. The path must begin with a "/" and is interpreted as relative to the current context root.- Specified by:
getRequestDispatcher
in interfacejakarta.servlet.ServletContext
-
getStaticResources
public DirContext getStaticResources()
Return the naming resources associated with this web application.
-
findStaticResources
public DirContext findStaticResources()
Return the naming resources associated with this web application. FIXME: Fooling introspection ...
-
getWelcomeFiles
public String[] getWelcomeFiles()
Return the naming resources associated with this web application.
-
setXmlValidation
public void setXmlValidation(boolean webXmlValidation)
Set the validation feature of the XML parser used when parsing xml instances.- Specified by:
setXmlValidation
in interfaceContext
- Parameters:
webXmlValidation
- true to enable xml instance validation
-
getXmlValidation
public boolean getXmlValidation()
Get the server.xmlattribute's xmlValidation. - Specified by:
getXmlValidation
in interfaceContext
- Returns:
- true if validation is enabled.
-
getXmlNamespaceAware
public boolean getXmlNamespaceAware()
Get the server.xmlattribute's xmlNamespaceAware. - Specified by:
getXmlNamespaceAware
in interfaceContext
- Returns:
- true if namespace awareness is enabled.
-
setXmlNamespaceAware
public void setXmlNamespaceAware(boolean webXmlNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.- Specified by:
setXmlNamespaceAware
in interfaceContext
- Parameters:
webXmlNamespaceAware
- true to enable namespace awareness
-
setTldValidation
public void setTldValidation(boolean tldValidation)
Set the validation feature of the XML parser used when parsing tlds files.- Specified by:
setTldValidation
in interfaceContext
- Parameters:
tldValidation
- true to enable xml instance validation
-
getTldValidation
public boolean getTldValidation()
Get the server.xmlattribute's webXmlValidation. - Specified by:
getTldValidation
in interfaceContext
- Returns:
- true if validation is enabled.
-
getTldNamespaceAware
public boolean getTldNamespaceAware()
Get the server.xmlattribute's xmlNamespaceAware. - Specified by:
getTldNamespaceAware
in interfaceContext
- Returns:
- true if namespace awarenes is enabled.
-
setTldNamespaceAware
public void setTldNamespaceAware(boolean tldNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.- Specified by:
setTldNamespaceAware
in interfaceContext
- Parameters:
tldNamespaceAware
- true to enable namespace awareness
-
setOrderedLibs
public void setOrderedLibs(List<String> orderedLibs)
Sets the list of ordered libs, which will be used as the value of the ServletContext attribute with name jakarta.servlet.context.orderedLibs
-
startRecursive
public void startRecursive() throws LifecycleException
- Throws:
LifecycleException
-
getState
public int getState()
Returns the state of the server.It will return 0, 1 3 or 4.
- Returns:
- 0 = STARTING; 1= RUNNING; 3 = STOPPED, 4 = FAILED
-
createObjectInputStream
public ObjectInputStream createObjectInputStream(InputStream is) throws IOException
Creates an ObjectInputStream that provides special deserialization logic for classes that are normally not serializable (such as javax.naming.Context).- Parameters:
is
-- Throws:
IOException
-
createObjectOutputStream
public ObjectOutputStream createObjectOutputStream(OutputStream os) throws IOException
Creates an ObjectOutputStream that provides special serialization logic for classes that are normally not serializable (such as javax.naming.Context).- Parameters:
os
-- Returns:
- Throws:
IOException
-
getStartTimeMillis
public long getStartTimeMillis()
Gets the time this context was started.- Returns:
- Time (in milliseconds since January 1, 1970, 00:00:00) when this context was started
-
isEventProvider
public boolean isEventProvider()
???- Returns:
- false
-
isStatisticsProvider
public boolean isStatisticsProvider()
???MBean stats? unused- Returns:
- false
-
sessionCreatedEvent
public void sessionCreatedEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider
-
sessionDestroyedEvent
public void sessionDestroyedEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionDestroyedEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionRejectedEvent
public void sessionRejectedEvent(int maxSessions)
Trigger for monitoring- Parameters:
maxSessions
-- See Also:
SessionStatsProvider.sessionRejectedEvent(int, java.lang.String, java.lang.String)
-
sessionExpiredEvent
public void sessionExpiredEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionExpiredEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionPersistedStartEvent
public void sessionPersistedStartEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionPersistedStartEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionPersistedEndEvent
public void sessionPersistedEndEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionPersistedEndEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionActivatedStartEvent
public void sessionActivatedStartEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionActivatedStartEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionActivatedEndEvent
public void sessionActivatedEndEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionActivatedEndEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionPassivatedStartEvent
public void sessionPassivatedStartEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionPassivatedStartEvent(java.lang.String, java.lang.String, java.lang.String)
-
sessionPassivatedEndEvent
public void sessionPassivatedEndEvent(jakarta.servlet.http.HttpSession session)
Trigger for monitoring- Parameters:
session
-- See Also:
SessionStatsProvider.sessionPassivatedEndEvent(java.lang.String, java.lang.String, java.lang.String)
-
getUniqueId
public long getUniqueId()
- Returns:
- 0
-
createServletInstance
protected <T extends jakarta.servlet.Servlet> T createServletInstance(Class<T> clazz) throws Exception
Instantiates the given Servlet class.- Returns:
- the new Servlet instance
- Throws:
Exception
-
createFilterInstance
protected <T extends jakarta.servlet.Filter> T createFilterInstance(Class<T> clazz) throws Exception
Instantiates the given Filter class.- Returns:
- the new Filter instance
- Throws:
Exception
-
createListenerInstance
public <T extends EventListener> T createListenerInstance(Class<T> clazz) throws Exception
Instantiates the given EventListener class.- Returns:
- the new EventListener instance
- Throws:
Exception
-
-