com.sun.enterprise.web
Class VirtualServer

java.lang.Object
  extended by org.apache.catalina.core.ContainerBase
      extended by org.apache.catalina.core.StandardHost
          extended by com.sun.enterprise.web.VirtualServer
All Implemented Interfaces:
java.io.Serializable, javax.management.MBeanRegistration, Container, Deployer, Host, Lifecycle, Pipeline, VirtualServer
Direct Known Subclasses:
PEVirtualServer

public class VirtualServer
extends StandardHost
implements VirtualServer

Standard implementation of a virtual server (aka virtual host) in the iPlanet Application Server.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.catalina.core.ContainerBase
ContainerBase.ContainerBackgroundProcessor, ContainerBase.PrivilegedAddChild
 
Field Summary
protected  java.util.logging.Logger _logger
          The logger to use for logging this virtual server
protected static java.util.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, logger, manager, mserver, name, notifyContainerListeners, oname, parent, parentClassLoader, pipeline, readLock, realm, resources, sm, started, suffix, support, type, writeLock
 
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.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.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
VirtualServer()
          Default constructor that simply gets a handle to the web container subsystem's logger.
 
Method Summary
 void addContext(Context context, java.lang.String contextRoot)
          Registers the given Context with this VirtualServer at the given context root.
protected  void addListener(java.lang.String listenerName)
          Adds the Catalina listener with the given class name to this VirtualServer.
 void addValve(GlassFishValve valve)
          Adds the given valve to the currently active pipeline, keeping the pipeline that is not currently active in sync.
protected  void addValve(java.lang.String valveName)
          Adds the Valve 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 clearAliases()
          Delete all aliases.
 void configure(java.lang.String vsID, VirtualServer vsBean, java.lang.String vsDocroot, java.lang.String vsLogFile, MimeMap vsMimeMap, java.lang.String logServiceFile, java.lang.String logLevel)
          Configures this virtual server.
protected  void configureCatalinaProperties()
          Configures the valve_ and listener_ properties of this VirtualServer.
protected  void configureRemoteAddressFilterValve(java.lang.String allow, java.lang.String deny)
          Configures the Remote Address Filter valve of this VirtualServer.
 void configureSingleSignOnCookieHttpOnly(javax.servlet.http.Cookie ssoCookie)
           
 void configureSingleSignOnCookieSecure(javax.servlet.http.Cookie ssoCookie, javax.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(java.lang.String contextRoot)
           
protected  WebModuleConfig findWebModuleInJ2eeApp(Applications appsBean, java.lang.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.
 boolean getAllowLinking()
          Gets the value of the allowLinking property of this virtual server.
 VirtualServer getBean()
          Gets the config bean associated with this VirtualServer.
 java.lang.String[] getCacheControls()
          Gets the Cache-Control configuration of this VirtualServer.
 VirtualServerConfig getConfig()
          Gets the current configuration of this VirtualServer.
 Context getContext(java.lang.String contextRoot)
          Finds the Context registered at the given context root.
 java.util.Collection<Context> getContexts()
          Gets the collection of Context instances registered with this VirtualServer.
protected  java.lang.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  java.lang.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.
 java.io.File getDocRoot()
          Gets the docroot of this VirtualServer.
 java.lang.String getID()
          Return the virtual server identifier.
 java.lang.String getInfo()
           
 MimeMap getMimeMap()
          Gets the mime map associated with this VirtualServer.
 java.util.Collection<WebListener> getWebListeners()
          Gets the collection of WebListener instances from which this VirtualServer receives requests.
 boolean isActive()
           
protected  boolean isActive(WebModule wm, boolean matchVSID)
          Determines whether the specified web module is "active" under this virtual server.
protected  java.lang.Object loadInstance(java.lang.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 VirtualServer
 void setCacheControls(java.lang.String[] cacheControls)
          Sets the Cache-Control configuration for this VirtualServer
 void setClassLoaderHierarchy(ClassLoaderHierarchy clh)
           
 void setCommandRunner(CommandRunner runner)
           
 void setConfig(VirtualServerConfig config)
          Reconfigures this VirtualServer with the given configuration.
 void setDefaultContextPath(java.lang.String defaultContextPath)
           
 void setDocRoot(java.io.File docRoot)
          Sets the docroot of this VirtualServer.
 void setDomain(Domain domain)
           
 void setFileLoggerHandlerFactory(FileLoggerHandlerFactory factory)
           
 void setHabitat(org.jvnet.hk2.component.Habitat habitat)
           
 void setID(java.lang.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 VirtualServer
 void setRealm(Realm realm)
           
 void setServerEnvironment(ServerEnvironment instance)
           
 void setWebListeners(WebListener... webListeners)
          Sets the collection of WebListener instances from which this VirtualServer receives requests.
 void stop()
           
 void updateWebXml(ContextFacade facade, java.io.File file)
           
 
Methods inherited from class org.apache.catalina.core.StandardHost
addAlias, addChild, addDefaultContext, addErrorPage, createObjectName, findAliases, findDeployedApp, findDeployedApps, findErrorPage, findMappingObject, getAliases, getAppBase, getAutoDeploy, getConfigClass, getContextClass, getDefaultContext, getDefaultContextXmlLocation, getDefaultWebXmlLocation, getDeployer, getDeployOnStartup, getErrorReportValveClass, getName, getNetworkListenerNames, getNetworkListeners, getSingleSignOn, getValveNames, getWorkDir, getXmlNamespaceAware, getXmlValidation, importDefaultContext, init, install, install, installDefaultContext, isDeployXML, isSecurePagesWithPragma, isUnpackWARs, map, preRegister, remove, remove, removeAlias, 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, getJSR77Suffix, getLoader, getLogger, getManager, getMappingObject, getObjectName, getParent, getParentClassLoader, getParentName, getPipeline, getRealm, getResources, getType, getValveObjectNames, getValves, hasCustomPipeline, hasNonBasicValves, invoke, isCheckIfRequestIsSecure, log, log, logName, postDeregister, postRegister, preDeregister, 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 java.util.ResourceBundle rb
The resource bundle containing the message strings for _logger.


_logger

protected volatile java.util.logging.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 java.lang.String getID()
Return the virtual server identifier.

Specified by:
getID in interface VirtualServer

setID

public void setID(java.lang.String id)
Set the virtual server identifier string.

Specified by:
setID in interface VirtualServer
Parameters:
id - New identifier for this virtual server

isActive

public boolean isActive()
Returns:
true if this virtual server is active, false otherwise

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.


setBean

public void setBean(VirtualServer vsBean)
Sets the config bean for this VirtualServer


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


getCacheControls

public java.lang.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(java.lang.String[] cacheControls)
Sets the Cache-Control configuration for this VirtualServer

Parameters:
cacheControls - Cache-Control configuration settings for this VirtualServer

setCommandRunner

public void setCommandRunner(CommandRunner runner)

getInfo

public java.lang.String getInfo()
Specified by:
getInfo in interface Container
Overrides:
getInfo in class StandardHost

setDefaultContextPath

public void setDefaultContextPath(java.lang.String defaultContextPath)

setFileLoggerHandlerFactory

public void setFileLoggerHandlerFactory(FileLoggerHandlerFactory factory)

setServerEnvironment

public void setServerEnvironment(ServerEnvironment instance)

setClassLoaderHierarchy

public void setClassLoaderHierarchy(ClassLoaderHierarchy clh)

setDomain

public void setDomain(Domain domain)

setHabitat

public void setHabitat(org.jvnet.hk2.component.Habitat habitat)

findChild

public Container findChild(java.lang.String contextRoot)
Specified by:
findChild in interface Container
Overrides:
findChild in class StandardHost

configureSingleSignOnCookieSecure

public void configureSingleSignOnCookieSecure(javax.servlet.http.Cookie ssoCookie,
                                              javax.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(javax.servlet.http.Cookie ssoCookie)
Overrides:
configureSingleSignOnCookieHttpOnly in class StandardHost

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

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

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

getDefaultContextPath

protected java.lang.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}".

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).


isActive

protected boolean isActive(WebModule wm,
                           boolean matchVSID)
Determines whether the specified web module is "active" under this virtual server. A web module is active if it meets ALL of the following conditions: - wm is not null - the enabled attribute of the web-module element is true If matchVSID is true then the following additional condition must be satisfied. - the virtual-servers attribute of the web-module element is either empty/not-specified or if specified then this virtual server's name/ID is one of the virtual servers specified in the list

Parameters:
wm - The bean containing the web module configuration information as specified in server.xml
matchVSID - This is set to false when testing to see if a web module that has been configured to be the default-web-module for a VS is active or not. In this case the only test is to check if the web module is enabled or not. When set to true, the virtual server list is examined to ensure that the web module has been configured to run on this virtual server.
Returns:
true if all the criteria are satisfied and false otherwise.

getDefaultWebModuleID

protected java.lang.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.


findWebModuleInJ2eeApp

protected WebModuleConfig findWebModuleInJ2eeApp(Applications appsBean,
                                                 java.lang.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.

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(java.lang.String vsID,
                      VirtualServer vsBean,
                      java.lang.String vsDocroot,
                      java.lang.String vsLogFile,
                      MimeMap vsMimeMap,
                      java.lang.String logServiceFile,
                      java.lang.String logLevel)
Configures this virtual server.


configureCatalinaProperties

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


addValve

protected void addValve(java.lang.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(java.lang.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 java.lang.Object loadInstance(java.lang.String className)
                                 throws java.lang.Exception
Overrides:
loadInstance in class StandardHost
Throws:
java.lang.Exception

configureRemoteAddressFilterValve

protected void configureRemoteAddressFilterValve(java.lang.String allow,
                                                 java.lang.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)
Specified by:
setRealm in interface Container
Overrides:
setRealm in class ContainerBase

setDocRoot

public void setDocRoot(java.io.File docRoot)
Sets the docroot of this VirtualServer.

Specified by:
setDocRoot in interface VirtualServer
Parameters:
docRoot - the docroot of this VirtualServer.

getDocRoot

public java.io.File getDocRoot()
Gets the docroot of this VirtualServer.

Specified by:
getDocRoot in interface 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 java.util.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,
                       java.lang.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
Throws:
ConfigException
GlassFishException

removeContext

public void removeContext(Context context)
                   throws GlassFishException
Stops the given context and removes it from this VirtualServer.

Specified by:
removeContext in interface VirtualServer
Throws:
GlassFishException

getContext

public Context getContext(java.lang.String contextRoot)
Finds the Context registered at the given context root.

Specified by:
getContext in interface VirtualServer

getContexts

public java.util.Collection<Context> getContexts()
Gets the collection of Context instances registered with this VirtualServer.

Specified by:
getContexts in interface 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
Throws:
ConfigException

getConfig

public VirtualServerConfig getConfig()
Gets the current configuration of this VirtualServer.

Specified by:
getConfig in interface VirtualServer

stop

public void stop()
          throws LifecycleException
Specified by:
stop in interface Lifecycle
Overrides:
stop in class ContainerBase
Throws:
LifecycleException

updateWebXml

public void updateWebXml(ContextFacade facade,
                         java.io.File file)
                  throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2012 GlassFish Community. All Rights Reserved.