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
_logger
The logger to use for logging this virtual serverprotected static ResourceBundle
rb
The 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 void
addContext(Context context, String contextRoot)
Registers the given Context with this VirtualServer at the given context root.protected void
addListener(String listenerName)
Adds the Catalina listener with the given class name to this VirtualServer.protected void
addValve(String valveName)
Adds theValve
with the given class name to this VirtualServer.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.void
addValve(GlassFishValve valve)
Adds the given valve to the currently active pipeline, keeping the pipeline that is not currently active in sync.void
clearAliases()
Delete all aliases.void
configure(String vsID, VirtualServer vsBean, String vsDocroot, String vsLogFile, MimeMap vsMimeMap, String logServiceFile, String logLevel)
Configures this virtual server.protected void
configureCatalinaProperties()
Configures the valve_ and listener_ properties of this VirtualServer.protected void
configureRemoteAddressFilterValve(String allow, String deny)
Configures the Remote Address Filter valve of this VirtualServer.void
configureSingleSignOnCookieHttpOnly(jakarta.servlet.http.Cookie ssoCookie)
Configures the HttpOnly attribute of the given SSO cookie.void
configureSingleSignOnCookieSecure(jakarta.servlet.http.Cookie ssoCookie, jakarta.servlet.http.HttpServletRequest hreq)
Configures the Secure attribute of the given SSO cookie.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.Container
findChild(String contextRoot)
Returns the context deployed at the given context root.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:b
ora#b
, wherea
is the name of the J2EE application andb
is the name of the embedded web module.boolean
getAllowLinking()
Gets the value of the allowLinking property of this virtual server.VirtualServer
getBean()
Gets the config bean associated with this VirtualServer.String[]
getCacheControls()
Gets the Cache-Control configuration of this VirtualServer.VirtualServerConfig
getConfig()
Gets the current configuration of this VirtualServer.Context
getContext(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 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.protected WebModuleConfig
getDefaultWebModule(Domain domain, WebArchivist webArchivist, ApplicationRegistry appRegistry)
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.File
getDocRoot()
Gets the docroot of this VirtualServer.String
getID()
Return the virtual server identifier.String
getInfo()
Return descriptive information about this Container implementation and the corresponding version number, in the format<description>/<version>
.MimeMap
getMimeMap()
Gets the mime map associated with this VirtualServer.Collection<WebListener>
getWebListeners()
Gets the collection of WebListener instances from which this VirtualServer receives requests.protected Object
loadInstance(String className)
void
removeContext(Context context)
Stops the given context and removes it from this VirtualServer.void
removeValve(GlassFishValve valve)
Removes the given valve from the currently active pipeline, keeping the valve that is not currently active in sync.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.void
setBean(VirtualServer vsBean)
Sets the config bean for this VirtualServervoid
setCacheControls(String[] cacheControls)
Sets the Cache-Control configuration for this VirtualServervoid
setClassLoaderHierarchy(ClassLoaderHierarchy clh)
void
setConfig(VirtualServerConfig config)
Reconfigures this VirtualServer with the given configuration.void
setDefaultContextPath(String defaultContextPath)
void
setDocRoot(File docRoot)
Sets the docroot of this VirtualServer.void
setDomain(Domain domain)
void
setFileLoggerHandlerFactory(FileLoggerHandlerFactory factory)
void
setID(String id)
Set the virtual server identifier string.void
setIsActive(boolean isActive)
Sets the state of this virtual server.void
setMimeMap(MimeMap mimeMap)
Sets the mime map for this VirtualServervoid
setRealm(Realm realm)
Set the Realm with which this Container is associated.void
setServices(org.glassfish.hk2.api.ServiceLocator services)
void
setWebListeners(WebListener... webListeners)
Sets the collection of WebListener instances from which this VirtualServer receives requests.void
stop()
Gracefully shut down active use of the public methods of this Component.void
updateWebXml(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:
getID
in interfaceVirtualServer
- Returns:
- the id of this VirtualServer
-
setID
public void setID(String id)
Set the virtual server identifier string.- Specified by:
setID
in 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:StandardHost
Return descriptive information about this Container implementation and the corresponding version number, in the format<description>/<version>
.- Specified by:
getInfo
in interfaceContainer
- Overrides:
getInfo
in 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:StandardHost
Returns the context deployed at the given context root.- Specified by:
findChild
in interfaceContainer
- Overrides:
findChild
in 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:
configureSingleSignOnCookieSecure
in 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:StandardHost
Configures the HttpOnly attribute of the given SSO cookie.- Overrides:
configureSingleSignOnCookieHttpOnly
in 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:
addValve
in interfacePipeline
- Overrides:
addValve
in 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:
addValve
in interfacePipeline
- Overrides:
addValve
in 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:
removeValve
in interfacePipeline
- Overrides:
removeValve
in 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:b
ora#b
, wherea
is the name of the J2EE application andb
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 theValve
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
-
loadInstance
protected Object loadInstance(String className) throws Exception
- Overrides:
loadInstance
in 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:ContainerBase
Set the Realm with which this Container is associated.- Specified by:
setRealm
in interfaceContainer
- Overrides:
setRealm
in classContainerBase
- Parameters:
realm
- The newly associated Realm
-
setDocRoot
public void setDocRoot(File docRoot)
Sets the docroot of this VirtualServer.- Specified by:
setDocRoot
in interfaceVirtualServer
- Parameters:
docRoot
- the docroot of this VirtualServer.
-
getDocRoot
public File getDocRoot()
Gets the docroot of this VirtualServer.- Specified by:
getDocRoot
in 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:
getWebListeners
in 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:
addContext
in interfaceVirtualServer
- Parameters:
context
- the Context to registercontextRoot
- the context root at which to register- Throws:
GlassFishException
ConfigException
- 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:
removeContext
in 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:
getContext
in 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:
getContexts
in 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:
setConfig
in 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:
getConfig
in 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 LifecycleException
Description copied from class:ContainerBase
Gracefully shut down active use of the public methods of this Component.- Specified by:
stop
in interfaceLifecycle
- Overrides:
stop
in 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
-
-