Package com.sun.enterprise.web
Class VirtualServer
- java.lang.Object
-
- org.apache.catalina.core.ContainerBase
-
- org.apache.catalina.core.StandardHost
-
- com.sun.enterprise.web.VirtualServer
-
- Direct Known Subclasses:
PEVirtualServer
public class VirtualServer extends StandardHost implements VirtualServer
Standard implementation of a virtual server (aka virtual host) in the Payara Server.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
-
-
Field Summary
Fields Modifier and Type Field Description protected Logger_loggerThe logger to use for logging this virtual serverprotected static ResourceBundlerbThe resource bundle containing the message strings for _logger.-
Fields inherited from class org.apache.catalina.core.StandardHost
aliases
-
Fields inherited from class org.apache.catalina.core.ContainerBase
backgroundProcessorDelay, checkIfRequestIsSecure, children, controller, debug, hasCustomPipeline, initialized, lifecycle, loader, log, logger, manager, name, notifyContainerListeners, oname, parent, parentClassLoader, pipeline, readLock, realm, resources, started, support, writeLock
-
Fields inherited from interface org.apache.catalina.Container
ADD_CHILD_EVENT, ADD_MAPPER_EVENT, ADD_VALVE_EVENT, REMOVE_CHILD_EVENT, REMOVE_MAPPER_EVENT, REMOVE_VALVE_EVENT
-
Fields inherited from interface org.apache.catalina.Deployer
INSTALL_EVENT, PRE_INSTALL_EVENT, REMOVE_EVENT
-
Fields inherited from interface org.apache.catalina.Host
ADD_ALIAS_EVENT, REMOVE_ALIAS_EVENT
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description VirtualServer()Default constructor that simply gets a handle to the web container subsystem's logger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddContext(Context context, String contextRoot)Registers the given Context with this VirtualServer at the given context root.protected voidaddListener(String listenerName)Adds the Catalina listener with the given class name to this VirtualServer.protected voidaddValve(String valveName)Adds theValvewith the given class name to this VirtualServer.voidaddValve(Valve valve)Adds the given Tomcat-style valve to the currently active pipeline, keeping the pipeline that is not currently active in sync.voidaddValve(GlassFishValve valve)Adds the given valve to the currently active pipeline, keeping the pipeline that is not currently active in sync.voidclearAliases()Delete all aliases.voidconfigure(String vsID, VirtualServer vsBean, String vsDocroot, String vsLogFile, MimeMap vsMimeMap, String logServiceFile, String logLevel)Configures this virtual server.protected voidconfigureCatalinaProperties()Configures the valve_ and listener_ properties of this VirtualServer.protected voidconfigureRemoteAddressFilterValve(String allow, String deny)Configures the Remote Address Filter valve of this VirtualServer.voidconfigureSingleSignOnCookieHttpOnly(jakarta.servlet.http.Cookie ssoCookie)Configures the HttpOnly attribute of the given SSO cookie.voidconfigureSingleSignOnCookieSecure(jakarta.servlet.http.Cookie ssoCookie, jakarta.servlet.http.HttpServletRequest hreq)Configures the Secure attribute of the given SSO cookie.WebModuleConfigcreateSystemDefaultWebModuleIfNecessary(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.ContainerfindChild(String contextRoot)Returns the context deployed at the given context root.protected WebModuleConfigfindWebModuleInJ2eeApp(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 forma:bora#b, whereais the name of the J2EE application andbis the name of the embedded web module.booleangetAllowLinking()Gets the value of the allowLinking property of this virtual server.VirtualServergetBean()Gets the config bean associated with this VirtualServer.String[]getCacheControls()Gets the Cache-Control configuration of this VirtualServer.VirtualServerConfiggetConfig()Gets the current configuration of this VirtualServer.ContextgetContext(String contextRoot)Finds the Context registered at the given context root.Collection<Context>getContexts()Gets the collection of Context instances registered with this VirtualServer.protected StringgetDefaultContextPath(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.protected WebModuleConfiggetDefaultWebModule(Domain domain, WebArchivist webArchivist, ApplicationRegistry appRegistry)protected StringgetDefaultWebModuleID()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.FilegetDocRoot()Gets the docroot of this VirtualServer.StringgetID()Return the virtual server identifier.StringgetInfo()Return descriptive information about this Container implementation and the corresponding version number, in the format<description>/<version>.MimeMapgetMimeMap()Gets the mime map associated with this VirtualServer.Collection<WebListener>getWebListeners()Gets the collection of WebListener instances from which this VirtualServer receives requests.protected ObjectloadInstance(String className)voidremoveContext(Context context)Stops the given context and removes it from this VirtualServer.voidremoveValve(GlassFishValve valve)Removes the given valve from the currently active pipeline, keeping the valve that is not currently active in sync.voidsetAllowLinking(boolean allowLinking)Sets the allowLinking property of this virtual server, which determines whether symblic links from this virtual server's docroot are followed.voidsetBean(VirtualServer vsBean)Sets the config bean for this VirtualServervoidsetCacheControls(String[] cacheControls)Sets the Cache-Control configuration for this VirtualServervoidsetClassLoaderHierarchy(ClassLoaderHierarchy clh)voidsetConfig(VirtualServerConfig config)Reconfigures this VirtualServer with the given configuration.voidsetDefaultContextPath(String defaultContextPath)voidsetDocRoot(File docRoot)Sets the docroot of this VirtualServer.voidsetDomain(Domain domain)voidsetFileLoggerHandlerFactory(FileLoggerHandlerFactory factory)voidsetID(String id)Set the virtual server identifier string.voidsetIsActive(boolean isActive)Sets the state of this virtual server.voidsetMimeMap(MimeMap mimeMap)Sets the mime map for this VirtualServervoidsetRealm(Realm realm)Set the Realm with which this Container is associated.voidsetServices(org.glassfish.hk2.api.ServiceLocator services)voidsetWebListeners(WebListener... webListeners)Sets the collection of WebListener instances from which this VirtualServer receives requests.voidstop()Gracefully shut down active use of the public methods of this Component.voidupdateWebXml(ContextFacade facade, File file)-
Methods inherited from class org.apache.catalina.core.StandardHost
addAlias, addChild, addErrorPage, createObjectName, findAliases, findDeployedApp, findDeployedApps, findErrorPage, findMappingObject, getAliases, getAppBase, getAutoDeploy, getConfigClass, getContextClass, getDefaultContextXmlLocation, getDefaultWebXmlLocation, getDeployer, getDeployOnStartup, getErrorReportValveClass, getName, getNetworkListenerNames, getNetworkListeners, getSingleSignOn, getValveNames, getWorkDir, getXmlNamespaceAware, getXmlValidation, init, install, install, isDeployXML, isSecurePagesWithPragma, isUnpackWARs, map, remove, remove, removeAlias, sendNotification, setAppBase, setAutoDeploy, setConfigClass, setContextClass, setDefaultContextXmlLocation, setDefaultWebXmlLocation, setDeployer, setDeployOnStartup, setDeployXML, setErrorReportValveClass, setName, setNetworkListenerNames, setPipeline, setSecurePagesWithPragma, setUnpackWARs, setWorkDir, setXmlNamespaceAware, setXmlValidation, start, start, stop, toString
-
Methods inherited from class org.apache.catalina.core.ContainerBase
addContainerListener, addLifecycleListener, addPropertyChangeListener, backgroundProcess, destroy, findChildren, findContainerListeners, findLifecycleListeners, fireContainerEvent, getBackgroundProcessorDelay, getBasic, getChildren, getContainerSuffix, getDebug, getDomain, getJmxName, getLoader, getLogger, getManager, getMappingObject, getObjectName, getParent, getParentClassLoader, getParentName, getPipeline, getRealm, getResources, getValveObjectNames, getValves, hasCustomPipeline, hasNonBasicValves, invoke, isCheckIfRequestIsSecure, log, log, logName, removeChild, removeContainerListener, removeLifecycleListener, removeLifecycleListeners, removePropertyChangeListener, setBackgroundProcessorDelay, setBasic, setCheckIfRequestIsSecure, setDebug, setDomain, setLoader, setLogger, setManager, setParent, setParentClassLoader, setResources, startChildren, threadStart, threadStop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.catalina.Container
addContainerListener, addPropertyChangeListener, backgroundProcess, findChildren, findContainerListeners, fireContainerEvent, getBackgroundProcessorDelay, getLoader, getLogger, getManager, getMappingObject, getParent, getParentClassLoader, getPipeline, getRealm, getResources, hasCustomPipeline, invoke, isCheckIfRequestIsSecure, removeChild, removeContainerListener, removePropertyChangeListener, setBackgroundProcessorDelay, setCheckIfRequestIsSecure, setLoader, setLogger, setManager, setParent, setParentClassLoader, setResources
-
-
-
-
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
-
-
Method Detail
-
getID
public String getID()
Return the virtual server identifier.- Specified by:
getIDin interfaceVirtualServer- Returns:
- the id of this VirtualServer
-
setID
public void setID(String id)
Set the virtual server identifier string.- Specified by:
setIDin interfaceVirtualServer- 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:StandardHostReturn descriptive information about this Container implementation and the corresponding version number, in the format<description>/<version>.- Specified by:
getInfoin interfaceContainer- Overrides:
getInfoin classStandardHost
-
setDefaultContextPath
public void setDefaultContextPath(String defaultContextPath)
-
setFileLoggerHandlerFactory
public void setFileLoggerHandlerFactory(FileLoggerHandlerFactory factory)
-
setClassLoaderHierarchy
public void setClassLoaderHierarchy(ClassLoaderHierarchy clh)
-
setDomain
public void setDomain(Domain domain)
-
findChild
public Container findChild(String contextRoot)
Description copied from class:StandardHostReturns the context deployed at the given context root.- Specified by:
findChildin interfaceContainer- Overrides:
findChildin classStandardHost- 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:
configureSingleSignOnCookieSecurein classStandardHost- Parameters:
ssoCookie- the SSO cookie to be configuredhreq- the HttpServletRequest that has initiated the SSO session
-
configureSingleSignOnCookieHttpOnly
public void configureSingleSignOnCookieHttpOnly(jakarta.servlet.http.Cookie ssoCookie)
Description copied from class:StandardHostConfigures the HttpOnly attribute of the given SSO cookie.- Overrides:
configureSingleSignOnCookieHttpOnlyin classStandardHost- 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:
addValvein interfacePipeline- Overrides:
addValvein classStandardHost- 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:
addValvein interfacePipeline- Overrides:
addValvein classContainerBase- 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:
removeValvein interfacePipeline- Overrides:
removeValvein classStandardHost- 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.
-
getDefaultWebModule
protected WebModuleConfig getDefaultWebModule(Domain domain, WebArchivist webArchivist, ApplicationRegistry appRegistry)
-
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 forma:bora#b, whereais the name of the J2EE application andbis the name of the embedded web module.- Parameters:
appsBean-id-- Returns:
- null if
iddoes 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 theValvewith 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
-
loadInstance
protected Object loadInstance(String className) throws Exception
- Overrides:
loadInstancein classStandardHost- Throws:
Exception
-
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:ContainerBaseSet the Realm with which this Container is associated.- Specified by:
setRealmin interfaceContainer- Overrides:
setRealmin classContainerBase- Parameters:
realm- The newly associated Realm
-
setDocRoot
public void setDocRoot(File docRoot)
Sets the docroot of this VirtualServer.- Specified by:
setDocRootin interfaceVirtualServer- Parameters:
docRoot- the docroot of this VirtualServer.
-
getDocRoot
public File getDocRoot()
Gets the docroot of this VirtualServer.- Specified by:
getDocRootin interfaceVirtualServer- 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:
getWebListenersin interfaceVirtualServer- 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:
addContextin interfaceVirtualServer- Parameters:
context- the Context to registercontextRoot- the context root at which to register- Throws:
GlassFishExceptionConfigException- if a Context already exists at the given context root on this VirtualServer
-
removeContext
public void removeContext(Context context) throws GlassFishException
Stops the given context and removes it from this VirtualServer.- Specified by:
removeContextin interfaceVirtualServer- Parameters:
context- the Context to be stopped and removed- Throws:
GlassFishException
-
getContext
public Context getContext(String contextRoot)
Finds the Context registered at the given context root.- Specified by:
getContextin interfaceVirtualServer- 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:
getContextsin interfaceVirtualServer- 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:
setConfigin interfaceVirtualServer- 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:
getConfigin interfaceVirtualServer- Returns:
- the current configuration of this VirtualServer, or null if no special configuration was ever applied to this VirtualServer
-
stop
public void stop() throws LifecycleExceptionDescription copied from class:ContainerBaseGracefully shut down active use of the public methods of this Component.- Specified by:
stopin interfaceLifecycle- Overrides:
stopin classStandardHost- Throws:
LifecycleException- if this component detects a fatal error that needs to be reported
-
updateWebXml
public void updateWebXml(ContextFacade facade, File file) throws Exception
- Throws:
Exception
-
-