Class StandardContext

  • All Implemented Interfaces:
    jakarta.servlet.ServletContext, Container, Context, Lifecycle, Pipeline
    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
    • 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.
      • directoryDeployed

        protected boolean directoryDeployed
      • showArchivedRealPathEnabled

        protected boolean showArchivedRealPathEnabled
      • servletReloadCheckSecs

        protected int servletReloadCheckSecs
      • directoryListing

        protected boolean directoryListing
        Should we generate directory listings?
    • Constructor Detail

      • StandardContext

        public StandardContext()
        Create a new StandardContext component with the default basic Valve.
    • Method Detail

      • getEncodedPath

        public String getEncodedPath()
        Description copied from interface: Context
        Return the URL encoded context path, using UTF-8.
        Specified by:
        getEncodedPath in interface Context
      • 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 interface Container
        Overrides:
        setName in class ContainerBase
        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 interface Context
        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 interface Context
      • setAvailable

        public void setAvailable​(boolean available)
        Set the application available flag for this Context.
        Specified by:
        setAvailable in interface Context
        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
      • setCharsetMapper

        public void setCharsetMapper​(CharsetMapper mapper)
        Set the Locale to character set mapper for this Context.
        Specified by:
        setCharsetMapper in interface Context
        Parameters:
        mapper - The new mapper
      • getRequestCharacterEncoding

        public String getRequestCharacterEncoding()
        Specified by:
        getRequestCharacterEncoding in interface jakarta.servlet.ServletContext
      • setRequestCharacterEncoding

        public void setRequestCharacterEncoding​(String encoding)
        Specified by:
        setRequestCharacterEncoding in interface jakarta.servlet.ServletContext
      • getResponseCharacterEncoding

        public String getResponseCharacterEncoding()
        Specified by:
        getResponseCharacterEncoding in interface jakarta.servlet.ServletContext
      • setResponseCharacterEncoding

        public void setResponseCharacterEncoding​(String encoding)
        Specified by:
        setResponseCharacterEncoding in interface jakarta.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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        Returns:
        the "allow crossing servlet contexts" flag
      • setCrossContext

        public void setCrossContext​(boolean crossContext)
        Sets the "allow crossing servlet contexts" flag.
        Specified by:
        setCrossContext in interface Context
        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 interface Context
      • getAltDDName

        public String getAltDDName()
        Return the alternate Deployment Descriptor name.
        Specified by:
        getAltDDName in interface Context
      • setAltDDName

        public void setAltDDName​(String altDDName)
        Set an alternate Deployment Descriptor name.
        Specified by:
        setAltDDName in interface Context
      • 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 interface Context
        Parameters:
        displayName - The new display name
      • getDistributable

        public boolean getDistributable()
        Return the distributable flag for this web application.
        Specified by:
        getDistributable in interface Context
      • setDistributable

        public void setDistributable​(boolean distributable)
        Set the distributable flag for this web application.
        Specified by:
        setDistributable in interface Context
        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 interface Context
      • 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 interface Context
        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 interface Container
        Overrides:
        getInfo in class ContainerBase
      • 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 interface Context
      • setLoginConfig

        public void setLoginConfig​(LoginConfig config)
        Set the login configuration descriptor for this web application.
        Specified by:
        setLoginConfig in interface Context
        Parameters:
        config - The new login configuration
      • getMapper

        public org.glassfish.grizzly.http.server.util.Mapper getMapper()
        Get the mapper associated with the context.
        Specified by:
        getMapper in interface Context
      • restrictedSetPipeline

        public void restrictedSetPipeline​(Pipeline pl)
        Sets a new pipeline
      • setNamingResources

        public void setNamingResources​(NamingResources namingResources)
        Set the naming resources for this web application.
        Specified by:
        setNamingResources in interface Context
        Parameters:
        namingResources - The new naming resources
      • getPath

        public String getPath()
        Return the context path for this Context.
        Specified by:
        getPath in interface 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.

        Specified by:
        setPath in interface Context
        Parameters:
        path - The new context path
      • getPublicId

        public String getPublicId()
        Return the public identifier of the deployment descriptor DTD that is currently being parsed.
        Specified by:
        getPublicId in interface Context
      • setPublicId

        public void setPublicId​(String publicId)
        Set the public identifier of the deployment descriptor DTD that is currently being parsed.
        Specified by:
        setPublicId in interface Context
        Parameters:
        publicId - The public identifier
      • getReloadable

        public boolean getReloadable()
        Return the reloadable flag for this web application.
        Specified by:
        getReloadable in interface Context
      • getOverride

        public boolean getOverride()
        Return the DefaultContext override flag for this web application.
        Specified by:
        getOverride in interface Context
      • 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 interface Context
      • setPrivileged

        public void setPrivileged​(boolean privileged)
        Set the privileged flag for this web application.
        Specified by:
        setPrivileged in interface Context
        Parameters:
        privileged - The new privileged flag
      • setReloadable

        public void setReloadable​(boolean reloadable)
        Set the reloadable flag for this web application.
        Specified by:
        setReloadable in interface Context
        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 interface Context
        Parameters:
        override - The new override flag
      • isJsfApplication

        public boolean isJsfApplication()
        Scan the parent when searching for TLD listeners.
        Specified by:
        isJsfApplication in interface Context
      • 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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
      • getSessionTimeout

        public int getSessionTimeout()
        Return the default session timeout (in minutes) for this web application.
        Specified by:
        getSessionTimeout in interface Context
        Specified by:
        getSessionTimeout in interface jakarta.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 interface Context
        Specified by:
        setSessionTimeout in interface jakarta.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 interface Container
        Overrides:
        setResources in class ContainerBase
        Parameters:
        resources - The newly associated DirContext
      • getReuseSessionID

        public boolean getReuseSessionID()
        Return the "reuse session IDs when creating sessions" flag
        Specified by:
        getReuseSessionID in interface Context
      • setReuseSessionID

        public void setReuseSessionID​(boolean reuse)
        Set the "reuse session IDs when creating sessions" flag
        Specified by:
        setReuseSessionID in interface Context
        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 interface Context
      • setAllowRelativeRedirect

        public void setAllowRelativeRedirect​(boolean allowRelativeURLs)
        Set whether this context allows sendRedirect() to redirect to a relative URL.
        Specified by:
        setAllowRelativeRedirect in interface Context
        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 interface Context
        Returns:
        array of Auditor objects, or null
      • setAuditors

        public void setAuditors​(Auditor[] auditor)
        Set the Auditors associated with this context.
        Specified by:
        setAuditors in interface Context
        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 interface Context
        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 interface Context
        Parameters:
        parameter - The new application parameter
      • addChild

        protected void addChild​(Container child,
                                boolean isProgrammatic,
                                boolean createRegistration)
        Adds the given child (Servlet) to this context.
        Parameters:
        child - the child (Servlet) to add
        isProgrammatic - true if the given child (Servlet) is being added via one of the programmatic interfaces, and false if it is declared in the deployment descriptor
        createRegistration - 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
      • addConstraint

        public void addConstraint​(SecurityConstraint constraint)
        Add a security constraint to the set for this web application.
        Specified by:
        addConstraint in interface Context
      • addEjb

        public void addEjb​(ContextEjb ejb)
        Add an EJB resource reference for this web application.
        Specified by:
        addEjb in interface Context
        Parameters:
        ejb - New EJB resource reference
      • addEnvironment

        public void addEnvironment​(ContextEnvironment environment)
        Add an environment entry for this web application.
        Specified by:
        addEnvironment in interface Context
        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 interface Context
        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 interface Context
        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 added
        isProgrammatic -
        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 interface Context
        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 added
        isMatchAfter - 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 interface jakarta.servlet.ServletContext
      • addFilter

        public jakarta.servlet.FilterRegistration.Dynamic addFilter​(String filterName,
                                                                    jakarta.servlet.Filter filter)
        Specified by:
        addFilter in interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.servlet.ServletContext
      • getSessionCookieConfig

        public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()
        Gets the session tracking cookie configuration of this ServletContext.
        Specified by:
        getSessionCookieConfig in interface Context
        Specified by:
        getSessionCookieConfig in interface jakarta.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 interface Context
        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 interface Context
        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 interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.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 the web.xml and web-fragment.xml resources of the web application represented by this ServletContext.
        Specified by:
        getJspConfigDescriptor in interface jakarta.servlet.ServletContext
      • getClassLoader

        public ClassLoader getClassLoader()
        Gets the class loader of the web application represented by this ServletContext.
        Specified by:
        getClassLoader in interface jakarta.servlet.ServletContext
      • declareRoles

        public void declareRoles​(String... roleNames)
        Specified by:
        declareRoles in interface jakarta.servlet.ServletContext
      • setEffectiveMajorVersion

        public void setEffectiveMajorVersion​(int effectiveMajorVersion)
      • getEffectiveMajorVersion

        public int getEffectiveMajorVersion()
        Specified by:
        getEffectiveMajorVersion in interface jakarta.servlet.ServletContext
      • setEffectiveMinorVersion

        public void setEffectiveMinorVersion​(int effectiveMinorVersion)
      • getEffectiveMinorVersion

        public int getEffectiveMinorVersion()
        Specified by:
        getEffectiveMinorVersion in interface jakarta.servlet.ServletContext
      • getVirtualServerName

        public String getVirtualServerName()
        Specified by:
        getVirtualServerName in interface jakarta.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 interface Context
        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 interface Context
        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 interface Context
        Parameters:
        locale - locale to map an encoding for
        encoding - 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 interface Context
        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 interface Context
        Parameters:
        extension - Filename extension being mapped
        mimeType - Corresponding MIME type
      • addParameter

        public void addParameter​(String name,
                                 String value)
        Add a new context initialization parameter.
        Specified by:
        addParameter in interface Context
        Parameters:
        name - Name of the new parameter
        value - 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 interface Context
        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 interface Context
        Parameters:
        name - The resource environment reference name
        type - The resource environment reference type
      • addResourceLink

        public void addResourceLink​(ContextResourceLink resourceLink)
        Add a resource link for this web application.
        Specified by:
        addResourceLink in interface Context
        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 interface Context
        Parameters:
        role - Security role used in the application
        link - 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 interface Context
        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 name
        urlPatterns - 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 interface Context
        Parameters:
        pattern - URL pattern to be mapped
        name - 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 mapped
        name - Name of the corresponding servlet to execute
        jspWildCard - 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 interface jakarta.servlet.ServletContext
      • addServlet

        public jakarta.servlet.ServletRegistration.Dynamic addServlet​(String servletName,
                                                                      jakarta.servlet.Servlet servlet)
        Specified by:
        addServlet in interface jakarta.servlet.ServletContext
      • addServlet

        public jakarta.servlet.ServletRegistration.Dynamic addServlet​(String servletName,
                                                                      Class<? extends jakarta.servlet.Servlet> servletClass)
        Specified by:
        addServlet in interface jakarta.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 interface Context
        Parameters:
        servletName - the servlet name
        instance - the servlet instance
        initParams - 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 interface Context
        Parameters:
        servletName - the servlet name
        servlet - the servlet instance
        initParams - Map containing the initialization parameters for the servlet
        urlPatterns - 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 interface jakarta.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 interface jakarta.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 interface jakarta.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 interface jakarta.servlet.ServletContext
      • addWatchedResource

        public void addWatchedResource​(String name)
        Add a new watched resource to the set recognized by this Context.
        Specified by:
        addWatchedResource in interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        Returns:
      • hasConstraints

        public boolean hasConstraints()
        Checks whether this web application has any security constraints defined.
        Specified by:
        hasConstraints in interface Context
        Returns:
      • findEjb

        public ContextEjb findEjb​(String name)
        Return the EJB resource reference with the specified name, if any; otherwise, return null.
        Specified by:
        findEjb in interface Context
        Parameters:
        name - Name of the desired EJB resource reference
        Returns:
      • findEjbs

        public ContextEjb[] findEjbs()
        Return the defined EJB resource references for this application. If there are none, a zero-length array is returned.
        Specified by:
        findEjbs in interface Context
        Returns:
      • findEnvironment

        public ContextEnvironment findEnvironment​(String name)
        Return the environment entry with the specified name, if any; otherwise, return null.
        Specified by:
        findEnvironment in interface Context
        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 interface Context
        Returns:
      • findErrorPage

        public ErrorPage findErrorPage​(int errorCode)
        Return the error page entry for the specified HTTP error code, if any; otherwise return null.
        Specified by:
        findErrorPage in interface Context
        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 return null.
        Specified by:
        findErrorPage in interface Context
        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 interface Context
        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 return null.
        Specified by:
        findFilterDef in interface Context
        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 interface Context
      • findFilterMaps

        public List<FilterMap> findFilterMaps()
        Return the list of filter mappings for this Context.
        Specified by:
        findFilterMaps in interface Context
        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 interface Context
      • findLocalEjb

        public ContextLocalEjb findLocalEjb​(String name)
        Return the local EJB resource reference with the specified name, if any; otherwise, return null.
        Specified by:
        findLocalEjb in interface Context
        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 interface Context
      • findMappingObject

        public Context findMappingObject()
        FIXME: Fooling introspection ...
      • findMessageDestination

        public MessageDestination findMessageDestination​(String name)
        Return the message destination with the specified name, if any; otherwise, return null.
        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, return null.
        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 return null.
        Specified by:
        findMimeMapping in interface Context
        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 interface Context
      • findParameter

        public String findParameter​(String name)
        Return the value for the specified context initialization parameter name, if any; otherwise return null.
        Specified by:
        findParameter in interface Context
        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 interface Context
      • findResource

        public ContextResource findResource​(String name)
        Return the resource reference with the specified name, if any; otherwise return null.
        Specified by:
        findResource in interface Context
        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 return null.
        Specified by:
        findResourceEnvRef in interface Context
        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 interface Context
      • findResourceLink

        public ContextResourceLink findResourceLink​(String name)
        Return the resource link with the specified name, if any; otherwise return null.
        Specified by:
        findResourceLink in interface Context
        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 interface Context
      • 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 interface Context
      • 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 interface Context
        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 interface Context
        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 interface Context
      • findServletMapping

        public String findServletMapping​(String pattern)
        Return the servlet name mapped by the specified pattern (if any); otherwise return null.
        Specified by:
        findServletMapping in interface Context
        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 interface Context
      • findStatusPage

        public ErrorPage findStatusPage​(int status)
        Return the context-relative URI of the error page for the specified HTTP status code, if any; otherwise return null.
        Specified by:
        findStatusPage in interface Context
        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 interface Context
      • findWelcomeFile

        public boolean findWelcomeFile​(String name)
        Return true if the specified welcome file is defined for this Context; otherwise return false.
        Specified by:
        findWelcomeFile in interface Context
        Parameters:
        name - Welcome file to verify
      • getWatchedResources

        public List<String> getWatchedResources()
        Gets the watched resources defined for this web application.
        Specified by:
        getWatchedResources in interface Context
      • 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 interface Context
      • findWrapperLifecycles

        public List<String> findWrapperLifecycles()
        Return the list of LifecycleListener classes that will be added to newly created Wrappers automatically.
        Specified by:
        findWrapperLifecycles in interface Context
      • findWrapperListeners

        public List<String> findWrapperListeners()
        Return the list of ContainerListener classes that will be added to newly created Wrappers automatically.
        Specified by:
        findWrapperListeners in interface Context
      • getAuthenticator

        public Authenticator getAuthenticator()
        Gets the Authenticator of this Context.
        Specified by:
        getAuthenticator in interface Context
        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 interface Context
        Throws:
        IllegalStateException - if the reloadable property is set to false.
      • removeApplicationParameter

        public void removeApplicationParameter​(String name)
        Remove the application parameter with the specified name from the set for this application.
        Specified by:
        removeApplicationParameter in interface Context
        Parameters:
        name - Name of the application parameter to remove
      • removeConstraints

        public void removeConstraints()
        Removes any security constraints from this web application.
        Specified by:
        removeConstraints in interface Context
      • removeEjb

        public void removeEjb​(String name)
        Remove any EJB resource reference with the specified name.
        Specified by:
        removeEjb in interface Context
        Parameters:
        name - Name of the EJB resource reference to remove
      • removeEnvironment

        public void removeEnvironment​(String name)
        Remove any environment entry with the specified name.
        Specified by:
        removeEnvironment in interface Context
        Parameters:
        name - Name of the environment entry to remove
      • removeErrorPages

        public void removeErrorPages()
        Removes any error page declarations.
        Specified by:
        removeErrorPages in interface Context
      • 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 interface Context
        Parameters:
        filterDef - Filter definition to be removed
      • removeFilterMaps

        public void removeFilterMaps()
        Removes any filter mappings from this Context.
        Specified by:
        removeFilterMaps in interface Context
      • 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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
        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 interface Context
      • removeWatchedResources

        public void removeWatchedResources()
        Clears any watched resources defined for this web application.
        Specified by:
        removeWatchedResources in interface Context
      • removeWrapperLifecycles

        public void removeWrapperLifecycles()
        Description copied from interface: Context
        Removes any Wrapper lifecycle listeners from this Context
        Specified by:
        removeWrapperLifecycles in interface Context
      • removeWrapperListeners

        public void removeWrapperListeners()
        Description copied from interface: Context
        Removes any Wrapper listeners from this Context
        Specified by:
        removeWrapperListeners in interface Context
      • 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 interface Context
      • 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 interface Context
      • filterStart

        public boolean filterStart()
        Configure and initialize the set of filters for this Context. Return true if all filter initialization completed successfully, or false otherwise.
      • filterStop

        public boolean filterStop()
        Finalize and release the set of filters for this Context. Return true if all filter finalization completed successfully, or false otherwise.
      • findFilterConfig

        public jakarta.servlet.FilterConfig findFilterConfig​(String name)
        Find and return the initialized FilterConfig for the specified filter name, if any; otherwise return null.
        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 use
        listenerClassName - 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. Return true if initialization was successfull, or false otherwise.
      • 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
      • getTypes

        protected org.glassfish.hk2.classmodel.reflect.Types getTypes()
      • isStandalone

        protected boolean isStandalone()
      • setServletContainerInitializerInterestList

        public void setServletContainerInitializerInterestList​(Iterable<jakarta.servlet.ServletContainerInitializer> initializers)
      • createLoader

        public void createLoader()
        Creates a classloader for this context.
      • 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 class ContainerBase
        Throws:
        Exception
      • toString

        public String toString()
        Return a String representation of this component.
        Overrides:
        toString in class Object
      • 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 interface Container
        Overrides:
        backgroundProcess in class ContainerBase
      • 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
      • 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 class ContainerBase
        Throws:
        Exception
      • getAttribute

        public Object getAttribute​(String name)
        Return the value of the specified context attribute, if any; otherwise return null.
        Specified by:
        getAttribute in interface jakarta.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 interface jakarta.servlet.ServletContext
      • getContextPath

        public String getContextPath()
        Returns the context path of the web application.
        Specified by:
        getContextPath in interface jakarta.servlet.ServletContext
      • getContext

        public jakarta.servlet.ServletContext getContext​(String uri)
        Return a ServletContext object that corresponds to a specified URI on the server.
        Specified by:
        getContext in interface jakarta.servlet.ServletContext
      • getInitParameter

        public String getInitParameter​(String name)
        Return the value of the specified initialization parameter, or null if this parameter does not exist.
        Specified by:
        getInitParameter in interface jakarta.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 interface jakarta.servlet.ServletContext
      • setInitParameter

        public boolean setInitParameter​(String name,
                                        String value)
        Specified by:
        setInitParameter in interface jakarta.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 interface jakarta.servlet.ServletContext
      • getMinorVersion

        public int getMinorVersion()
        Return the minor version of the Java Servlet API that we implement.
        Specified by:
        getMinorVersion in interface jakarta.servlet.ServletContext
      • getMimeType

        public String getMimeType​(String file)
        Return the MIME type of the specified file, or null if the MIME type cannot be determined.
        Specified by:
        getMimeType in interface jakarta.servlet.ServletContext
      • getNamedDispatcher

        public jakarta.servlet.RequestDispatcher getNamedDispatcher​(String name)
        Return a RequestDispatcher object that acts as a wrapper for the named servlet.
        Specified by:
        getNamedDispatcher in interface jakarta.servlet.ServletContext
      • getServletContextName

        public String getServletContextName()
        Return the display name of this web application.
        Specified by:
        getServletContextName in interface jakarta.servlet.ServletContext
      • removeAttribute

        public void removeAttribute​(String name)
        Remove the context attribute with the specified name, if any.
        Specified by:
        removeAttribute in interface jakarta.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 interface jakarta.servlet.ServletContext
      • getServerInfo

        public String getServerInfo()
        Return the name and version of the servlet container.
        Specified by:
        getServerInfo in interface jakarta.servlet.ServletContext
      • getRealPath

        public String getRealPath​(String path)
        Return the real path corresponding to the given virtual path, or null if the container was unable to perform the translation
        Specified by:
        getRealPath in interface jakarta.servlet.ServletContext
      • log

        public void log​(String message)
        Writes the specified message to a servlet log file.
        Specified by:
        log in interface jakarta.servlet.ServletContext
        Overrides:
        log in class ContainerBase
        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 interface jakarta.servlet.ServletContext
        Overrides:
        log in class ContainerBase
        Parameters:
        message - Message to be logged
        throwable - Related exception
      • getResourceAsStream

        public InputStream getResourceAsStream​(String path)
        Return the requested resource as an InputStream. The path must be specified according to the rules described under getResource. If no such resource can be identified, return null.
        Specified by:
        getResourceAsStream in interface jakarta.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 interface jakarta.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 interface jakarta.servlet.ServletContext
      • getRequestDispatcher

        public jakarta.servlet.RequestDispatcher getRequestDispatcher​(String path)
        Return a RequestDispatcher 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 interface jakarta.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 interface Context
        Parameters:
        webXmlValidation - true to enable xml instance validation
      • getXmlValidation

        public boolean getXmlValidation()
        Get the server.xml attribute's xmlValidation.
        Specified by:
        getXmlValidation in interface Context
        Returns:
        true if validation is enabled.
      • getXmlNamespaceAware

        public boolean getXmlNamespaceAware()
        Get the server.xml attribute's xmlNamespaceAware.
        Specified by:
        getXmlNamespaceAware in interface Context
        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 interface Context
        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 interface Context
        Parameters:
        tldValidation - true to enable xml instance validation
      • getTldValidation

        public boolean getTldValidation()
        Get the server.xml attribute's webXmlValidation.
        Specified by:
        getTldValidation in interface Context
        Returns:
        true if validation is enabled.
      • getTldNamespaceAware

        public boolean getTldNamespaceAware()
        Get the server.xml attribute's xmlNamespaceAware.
        Specified by:
        getTldNamespaceAware in interface Context
        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 interface Context
        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
      • 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
      • 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
      • createHttpUpgradeHandlerInstance

        public <T extends jakarta.servlet.http.HttpUpgradeHandler> T createHttpUpgradeHandlerInstance​(Class<T> clazz)
                                                                                               throws Exception
        Instantiates the given HttpUpgradeHandler class.
        Type Parameters:
        T -
        Parameters:
        clazz -
        Returns:
        a new T instance
        Throws:
        Exception