Class VirtualServer

    • Field Detail

      • rb

        protected static final ResourceBundle rb
        The resource bundle containing the message strings for _logger.
      • _logger

        protected Logger _logger
        The logger to use for logging this virtual server
    • Constructor Detail

      • VirtualServer

        public VirtualServer()
        Default constructor that simply gets a handle to the web container subsystem's logger.
    • Method Detail

      • getID

        public String getID()
        Return the virtual server identifier.
        Specified by:
        getID in interface VirtualServer
        Returns:
        the id of this VirtualServer
      • setID

        public void setID​(String id)
        Set the virtual server identifier string.
        Specified by:
        setID in interface VirtualServer
        Parameters:
        id - New identifier for this virtual server
      • setIsActive

        public void setIsActive​(boolean isActive)
        Sets the state of this virtual server.
        Parameters:
        isActive - true if this virtual server is active, false otherwise
      • getAllowLinking

        public boolean getAllowLinking()
        Gets the value of the allowLinking property of this virtual server.
        Returns:
        true if symbolic links from this virtual server's docroot (as well as symbolic links from archives of web modules deployed on this virtual server) are followed, false otherwise
      • setAllowLinking

        public void setAllowLinking​(boolean allowLinking)
        Sets the allowLinking property of this virtual server, which determines whether symblic links from this virtual server's docroot are followed. This property is inherited by all web modules deployed on this virtual server, unless overridden by the allowLinking property in a web module's sun-web.xml.
        Parameters:
        allowLinking - Value of allowLinking property
      • getBean

        public VirtualServer getBean()
        Gets the config bean associated with this VirtualServer.
        Returns:
      • setBean

        public void setBean​(VirtualServer vsBean)
        Sets the config bean for this VirtualServer
        Parameters:
        vsBean -
      • getMimeMap

        public MimeMap getMimeMap()
        Gets the mime map associated with this VirtualServer.
      • setMimeMap

        public void setMimeMap​(MimeMap mimeMap)
        Sets the mime map for this VirtualServer
        Parameters:
        mimeMap -
      • getCacheControls

        public String[] getCacheControls()
        Gets the Cache-Control configuration of this VirtualServer.
        Returns:
        Cache-Control configuration of this VirtualServer, or null if no such configuration exists for this VirtualServer
      • setCacheControls

        public void setCacheControls​(String[] cacheControls)
        Sets the Cache-Control configuration for this VirtualServer
        Parameters:
        cacheControls - Cache-Control configuration settings for this VirtualServer
      • setServices

        public void setServices​(org.glassfish.hk2.api.ServiceLocator services)
      • getInfo

        public String getInfo()
        Description copied from class: StandardHost
        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 StandardHost
      • setDefaultContextPath

        public void setDefaultContextPath​(String defaultContextPath)
      • setDomain

        public void setDomain​(Domain domain)
      • findChild

        public Container findChild​(String contextRoot)
        Description copied from class: StandardHost
        Returns the context deployed at the given context root.
        Specified by:
        findChild in interface Container
        Overrides:
        findChild in class StandardHost
        Parameters:
        contextRoot - The context root whose associated context to return
        Returns:
        The context deployed at the given context root, or null
      • configureSingleSignOnCookieSecure

        public void configureSingleSignOnCookieSecure​(jakarta.servlet.http.Cookie ssoCookie,
                                                      jakarta.servlet.http.HttpServletRequest hreq)
        Configures the Secure attribute of the given SSO cookie.
        Overrides:
        configureSingleSignOnCookieSecure in class StandardHost
        Parameters:
        ssoCookie - the SSO cookie to be configured
        hreq - the HttpServletRequest that has initiated the SSO session
      • configureSingleSignOnCookieHttpOnly

        public void configureSingleSignOnCookieHttpOnly​(jakarta.servlet.http.Cookie ssoCookie)
        Description copied from class: StandardHost
        Configures the HttpOnly attribute of the given SSO cookie.
        Overrides:
        configureSingleSignOnCookieHttpOnly in class StandardHost
        Parameters:
        ssoCookie - the SSO ccokie to be configured
      • addValve

        public void addValve​(GlassFishValve valve)
        Adds the given valve to the currently active pipeline, keeping the pipeline that is not currently active in sync.
        Specified by:
        addValve in interface Pipeline
        Overrides:
        addValve in class StandardHost
        Parameters:
        valve - Valve to be added
      • addValve

        public void addValve​(Valve valve)
        Adds the given Tomcat-style valve to the currently active pipeline, keeping the pipeline that is not currently active in sync.
        Specified by:
        addValve in interface Pipeline
        Overrides:
        addValve in class ContainerBase
        Parameters:
        valve -
      • removeValve

        public void removeValve​(GlassFishValve valve)
        Removes the given valve from the currently active pipeline, keeping the valve that is not currently active in sync.
        Specified by:
        removeValve in interface Pipeline
        Overrides:
        removeValve in class StandardHost
        Parameters:
        valve - Valve to be removed
      • getDefaultContextPath

        protected String getDefaultContextPath​(Domain domain,
                                               ApplicationRegistry appRegistry)
        Gets the context root of the web module that the user/configuration has designated as the default-web-module for this virtual server. The default-web-module for a virtual server is specified via the 'default-web-module' attribute of the 'virtual-server' element in server.xml. This is an optional attribute and if the configuration does not specify another web module (standalone or part of a j2ee-application) that is configured at a context-root="", then a default web module will be created and loaded. The value for this attribute is either "${standalone-web-module-name}" or "${j2ee-app-name}:${web-module-uri}".
        Parameters:
        domain -
        appRegistry -
        Returns:
        null if the default-web-module has not been specified or if the web module specified either could not be found or is disabled or does not specify this virtual server (if it specifies a value for the virtual-servers attribute) or if there was an error loading its deployment descriptors.
      • createSystemDefaultWebModuleIfNecessary

        public WebModuleConfig createSystemDefaultWebModuleIfNecessary​(WebArchivist webArchivist)
        If a default web module has not yet been configured and added to this virtual server's list of web modules then return the configuration information needed in order to create a default web module for this virtual server.

        This method should be invoked only after all the standalone modules and the modules within j2ee-application elements have been added to this virtual server's list of modules (only then will one know whether the user has already configured a default web module or not).

        Parameters:
        webArchivist -
        Returns:
      • getDefaultWebModuleID

        protected String getDefaultWebModuleID()
        Returns the id of the default web module for this virtual server as specified in the 'default-web-module' attribute of the 'virtual-server' element.
        Returns:
      • findWebModuleInJ2eeApp

        protected WebModuleConfig findWebModuleInJ2eeApp​(Applications appsBean,
                                                         String id,
                                                         ApplicationRegistry appRegistry)
        Finds and returns information about a web module embedded within a J2EE application, which is identified by a string of the form a:b or a#b, where a is the name of the J2EE application and b is the name of the embedded web module.
        Parameters:
        appsBean -
        id -
        Returns:
        null if id does not identify a web module embedded within a J2EE application.
      • clearAliases

        public void clearAliases()
        Delete all aliases.
      • configure

        public void configure​(String vsID,
                              VirtualServer vsBean,
                              String vsDocroot,
                              String vsLogFile,
                              MimeMap vsMimeMap,
                              String logServiceFile,
                              String logLevel)
        Configures this virtual server.
        Parameters:
        vsID -
        vsBean -
        vsDocroot -
        vsLogFile -
        logServiceFile -
        logLevel -
      • configureCatalinaProperties

        protected void configureCatalinaProperties()
        Configures the valve_ and listener_ properties of this VirtualServer.
      • addValve

        protected void addValve​(String valveName)
        Adds the Valve with the given class name to this VirtualServer.
        Parameters:
        valveName - The valve's fully qualified class nam
      • addListener

        protected void addListener​(String listenerName)
        Adds the Catalina listener with the given class name to this VirtualServer.
        Parameters:
        listenerName - The fully qualified class name of the listener
      • configureRemoteAddressFilterValve

        protected void configureRemoteAddressFilterValve​(String allow,
                                                         String deny)
        Configures the Remote Address Filter valve of this VirtualServer. This valve enforces request accpetance/denial based on the string representation of the remote client's IP address.
      • setRealm

        public void setRealm​(Realm realm)
        Description copied from class: ContainerBase
        Set the Realm with which this Container is associated.
        Specified by:
        setRealm in interface Container
        Overrides:
        setRealm in class ContainerBase
        Parameters:
        realm - The newly associated Realm
      • setDocRoot

        public void setDocRoot​(File docRoot)
        Sets the docroot of this VirtualServer.
        Specified by:
        setDocRoot in interface VirtualServer
        Parameters:
        docRoot - the docroot of this VirtualServer.
      • getDocRoot

        public File getDocRoot()
        Gets the docroot of this VirtualServer.
        Specified by:
        getDocRoot in interface VirtualServer
        Returns:
        the docroot of this VirtualServer
      • setWebListeners

        public void setWebListeners​(WebListener... webListeners)
        Sets the collection of WebListener instances from which this VirtualServer receives requests.
        Parameters:
        webListeners - the collection of WebListener instances from which this VirtualServer receives requests.
      • getWebListeners

        public Collection<WebListener> getWebListeners()
        Gets the collection of WebListener instances from which this VirtualServer receives requests.
        Specified by:
        getWebListeners in interface VirtualServer
        Returns:
        the collection of WebListener instances from which this VirtualServer receives requests.
      • addContext

        public void addContext​(Context context,
                               String contextRoot)
                        throws ConfigException,
                               GlassFishException
        Registers the given Context with this VirtualServer at the given context root.

        If this VirtualServer has already been started, the given context will be started as well.

        Specified by:
        addContext in interface VirtualServer
        Parameters:
        context - the Context to register
        contextRoot - the context root at which to register
        Throws:
        GlassFishException
        ConfigException - if a Context already exists at the given context root on this VirtualServer
      • getContext

        public Context getContext​(String contextRoot)
        Finds the Context registered at the given context root.
        Specified by:
        getContext in interface VirtualServer
        Parameters:
        contextRoot - the context root whose Context to get
        Returns:
        the Context registered at the given context root, or null if no Context exists at the given context root
      • getContexts

        public Collection<Context> getContexts()
        Gets the collection of Context instances registered with this VirtualServer.
        Specified by:
        getContexts in interface VirtualServer
        Returns:
        the (possibly empty) collection of Context instances registered with this VirtualServer
      • setConfig

        public void setConfig​(VirtualServerConfig config)
                       throws ConfigException
        Reconfigures this VirtualServer with the given configuration.

        In order for the given configuration to take effect, this VirtualServer may be stopped and restarted.

        Specified by:
        setConfig in interface VirtualServer
        Parameters:
        config - the configuration to be applied
        Throws:
        ConfigException - if the configuration requires a restart, and this VirtualServer fails to be restarted
      • getConfig

        public VirtualServerConfig getConfig()
        Gets the current configuration of this VirtualServer.
        Specified by:
        getConfig in interface VirtualServer
        Returns:
        the current configuration of this VirtualServer, or null if no special configuration was ever applied to this VirtualServer