Methods Summary |
---|
protected void | addListener(java.lang.String listenerName)Adds the Catalina listener with the given class name to this
VirtualServer.
Object listener = loadInstance(listenerName);
if ( listener == null ) return;
if (listener instanceof ContainerListener) {
addContainerListener((ContainerListener)listener);
} else if (listener instanceof LifecycleListener){
addLifecycleListener((LifecycleListener)listener);
} else {
_logger.log(Level.SEVERE,"webcontainer.invalidListener"
+ listenerName);
}
|
public synchronized void | addValve(org.apache.catalina.Valve valve)Adds the given valve to the currently active pipeline, keeping the
valve that is not currently active in sync.
super.addValve(valve);
if (pipeline == vsPipeline) {
origPipeline.addValve(valve);
} else {
vsPipeline.addValve(valve);
}
|
protected void | addValve(java.lang.String valveName)Adds the Valve with the given class name to this
VirtualServer.
Valve valve = (Valve)loadInstance(valveName);
if (valve == null) return;
super.addValve(valve);
|
public void | clearAliases()Delete all aliases.
aliases = new String[0];
|
void | configureAliases()Configure virtual-server alias attribute.
// Add each host name from the 'hosts' attribute as an alias
List hosts = StringUtils.parseStringList(vsBean.getHosts(), ",");
for (int i=0; i < hosts.size(); i++ ){
String alias = hosts.get(i).toString();
if ( !alias.equalsIgnoreCase("localhost.localdomain")){
addAlias(alias);
}
}
|
void | configureAuthRealm(com.sun.enterprise.config.serverbeans.SecurityService securityService)Configures this virtual server with its authentication realm.
Checks if this virtual server specifies any authRealm property, and
if so, ensures that its value identifies a valid realm.
ElementProperty prop = vsBean.getElementPropertyByName("authRealm");
if (prop != null && prop.getValue() != null) {
if (securityService.getAuthRealmByName(prop.getValue()) != null) {
authRealmName = prop.getValue();
} else {
_logger.log(Level.SEVERE, "vs.invalidAuthRealm",
new Object[] { getID(), prop.getValue() });
}
}
|
void | configureCacheControl(java.lang.String cacheControl)Configures the cache control of this VirtualServer
if (cacheControl != null) {
List values = StringUtils.parseStringList(cacheControl,
",");
if (values != null && !values.isEmpty()) {
String[] cacheControls = new String[values.size()];
setCacheControls((String[]) values.toArray(cacheControls));
}
}
|
protected void | configureCatalinaProperties()Configures the valve_ and listener_ properties of this VirtualServer.
ElementProperty[] props = vsBean.getElementProperty();
if (props == null) {
return;
}
for (int i=0; i<props.length; i++) {
String propName = props[i].getName();
String propValue = props[i].getValue();
if (propName == null || propValue == null) {
_logger.log(Level.WARNING,
"webcontainer.nullWebModuleProperty",
getName());
}
if (propName.startsWith("valve_")) {
addValve(propValue);
} else if (propName.startsWith("listener_")) {
addListener(propValue);
} else if (propName.equals("securePagesWithPragma")){
setSecurePagesWithPragma(Boolean.valueOf(propValue));
}
}
|
void | configureErrorPage()Configures this VirtualServer with its send-error properties.
ErrorPage errorPage = null;
if (vsBean == null) {
return;
}
ElementProperty[] props = vsBean.getElementProperty();
if (props == null) {
return;
}
for (int i=0; i<props.length; i++) {
String propName = props[i].getName();
String propValue = props[i].getValue();
if (propName == null || propValue == null) {
_logger.log(Level.WARNING,
"webcontainer.nullVirtualServerProperty",
getID());
continue;
}
if (!propName.startsWith("send-error_")) {
continue;
}
/*
* Validate the prop value
*/
String path = null;
String reason = null;
String status = null;
String[] errorParams = propValue.split(" ");
for (int j=0; j<errorParams.length; j++) {
if (errorParams[j].startsWith("path=")) {
if (path != null) {
_logger.log(Level.WARNING,
"webcontainer.sendErrorMultipleElement",
new Object[] { propValue, "path" });
}
path = errorParams[j].substring("path=".length());
}
if (errorParams[j].startsWith("reason=")) {
if (reason != null) {
_logger.log(Level.WARNING,
"webcontainer.sendErrorMultipleElement",
new Object[] { propValue, "reason" });
}
reason = errorParams[j].substring("reason=".length());
}
if (errorParams[j].startsWith("code=")) {
if (status != null) {
_logger.log(Level.WARNING,
"webcontainer.sendErrorMultipleElement",
new Object[] { propValue, "code" });
}
status = errorParams[j].substring("code=".length());
}
}
if (path == null || path.length() == 0) {
_logger.log(Level.WARNING,
"webcontainer.sendErrorMissingPath",
propValue);
}
errorPage = new ErrorPage();
errorPage.setLocation(path);
errorPage.setErrorCode(status);
errorPage.setReason(reason);
addErrorPage(errorPage);
}
|
void | configureRedirect()Configures this VirtualServer with its redirect properties.
vsPipeline.clearRedirects();
if (vsBean == null) {
return;
}
ElementProperty[] props = vsBean.getElementProperty();
if (props == null) {
return;
}
for (int i=0; i<props.length; i++) {
String propName = props[i].getName();
String propValue = props[i].getValue();
if (propName == null || propValue == null) {
_logger.log(Level.WARNING,
"webcontainer.nullVirtualServerProperty",
getID());
continue;
}
if (!propName.startsWith("redirect_")) {
continue;
}
/*
* Validate the prop value
*/
String from = null;
String url = null;
String urlPrefix = null;
String escape = null;
String[] redirectParams = propValue.split(" ");
for (int j=0; j<redirectParams.length; j++) {
if (redirectParams[j].startsWith("from=")) {
if (from != null) {
_logger.log(Level.WARNING,
"webcontainer.redirectMultipleElement",
new Object[] { propValue, "from" });
}
from = redirectParams[j].substring("from=".length());
}
if (redirectParams[j].startsWith("url=")) {
if (url != null) {
_logger.log(Level.WARNING,
"webcontainer.redirectMultipleElement",
new Object[] { propValue, "url" });
}
url = redirectParams[j].substring("url=".length());
}
if (redirectParams[j].startsWith("url-prefix=")) {
if (urlPrefix != null) {
_logger.log(Level.WARNING,
"webcontainer.redirectMultipleElement",
new Object[] { propValue, "url-prefix" });
}
urlPrefix = redirectParams[j].substring(
"url-prefix=".length());
}
if (redirectParams[j].startsWith("escape=")) {
if (escape != null) {
_logger.log(Level.WARNING,
"webcontainer.redirectMultipleElement",
new Object[] { propValue, "escape" });
}
escape = redirectParams[j].substring("escape=".length());
}
}
if (from == null || from.length() == 0) {
_logger.log(Level.WARNING,
"webcontainer.redirectMissingFrom",
propValue);
}
// Either url or url-prefix (but not both!) must be present
if ((url == null || url.length() == 0)
&& (urlPrefix == null || urlPrefix.length() == 0)) {
_logger.log(Level.WARNING,
"webcontainer.redirectMissingUrlOrUrlPrefix",
propValue);
}
if (url != null && url.length() > 0
&& urlPrefix != null && urlPrefix.length() > 0) {
_logger.log(Level.WARNING,
"webcontainer.redirectBothUrlAndUrlPrefix",
propValue);
}
boolean escapeURI = true;
if (escape != null) {
if ("yes".equalsIgnoreCase(escape)) {
escapeURI = true;
} else if ("no".equalsIgnoreCase(escape)) {
escapeURI = false;
} else {
_logger.log(Level.WARNING,
"webcontainer.redirectInvalidEscape",
propValue);
}
}
vsPipeline.addRedirect(from, url, urlPrefix, escapeURI);
}
if (vsPipeline.hasRedirects()) {
if (pipeline != vsPipeline) {
// Enable custom pipeline
setPipeline(vsPipeline);
}
} else if (isActive && pipeline != origPipeline) {
setPipeline(origPipeline);
}
|
void | configureRemoteAddressFilterValve()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.
RemoteAddrValve remoteAddrValve = null;
if (vsBean == null) {
return;
}
ElementProperty allow = vsBean.getElementPropertyByName(
"allowRemoteAddress");
ElementProperty deny = vsBean.getElementPropertyByName(
"denyRemoteAddress");
if ((allow != null && allow.getValue() != null)
|| (deny != null && deny.getValue() != null)) {
remoteAddrValve = new RemoteAddrValve();
}
if (allow != null && allow.getValue() != null) {
_logger.fine("Allowing access to " + getID()+ " from " +
allow.getValue());
remoteAddrValve.setAllow(allow.getValue());
}
if (deny != null && deny.getValue() != null) {
_logger.fine("Denying access to " + getID()+ " from " +
deny.getValue());
remoteAddrValve.setDeny(deny.getValue());
}
if (remoteAddrValve != null) {
// Remove existing RemoteAddrValve (if any), in case of a reconfig
Valve[] valves = getValves();
for (int i=0; valves!=null && i<valves.length; i++) {
if (valves[i] instanceof RemoteAddrValve) {
removeValve(valves[i]);
break;
}
}
addValve(remoteAddrValve);
}
|
void | configureRemoteHostFilterValve(com.sun.enterprise.config.serverbeans.HttpProtocol httpProtocol)Configures the Remote Host Filter valve of this VirtualServer.
This valve enforces request acceptance/denial based on the name of the
remote host from where the request originated.
RemoteHostValve remoteHostValve = null;
if (vsBean == null) {
return;
}
ElementProperty allow = vsBean.getElementPropertyByName(
"allowRemoteHost");
ElementProperty deny = vsBean.getElementPropertyByName(
"denyRemoteHost");
if ((allow != null && allow.getValue() != null)
|| (deny != null && deny.getValue() != null)) {
remoteHostValve = new RemoteHostValve();
}
if (allow != null && allow.getValue() != null) {
_logger.fine("Allowing access to " + getID()+ " from " +
allow.getValue());
if (httpProtocol == null || !httpProtocol.isDnsLookupEnabled()) {
_logger.log(Level.WARNING,
"webcontainer.allowRemoteHost.dnsLookupDisabled",
getID());
}
remoteHostValve.setAllow(allow.getValue());
}
if (deny != null && deny.getValue() != null) {
_logger.fine("Denying access to " + getID()+ " from " +
deny.getValue());
if (httpProtocol == null || !httpProtocol.isDnsLookupEnabled()) {
_logger.log(Level.WARNING,
"webcontainer.denyRemoteHost.dnsLookupDisabled",
getID());
}
remoteHostValve.setDeny(deny.getValue());
}
if (remoteHostValve != null) {
// Remove existing RemoteHostValve (if any), in case of a reconfig
Valve[] valves = getValves();
for (int i=0; valves!=null && i<valves.length; i++) {
if (valves[i] instanceof RemoteHostValve) {
removeValve(valves[i]);
break;
}
}
addValve(remoteHostValve);
}
|
void | configureSSOValve(boolean globalSSOEnabled, com.sun.enterprise.server.pluggable.WebContainerFeatureFactory webContainerFeatureFactory)Configures the SSO valve of this VirtualServer.
if (vsBean == null) {
return;
}
if (!isSSOEnabled(globalSSOEnabled)) {
/*
* Disable SSO
*/
Object[] params = { getID() };
_logger.log(Level.INFO, "webcontainer.ssodisabled", params);
// Remove existing SSO valve (if any)
Valve[] valves = getValves();
for (int i=0; valves!=null && i<valves.length; i++) {
if (valves[i] instanceof SingleSignOn) {
removeValve(valves[i]);
break;
}
}
} else {
/*
* Enable SSO
*/
try {
SSOFactory ssoFactory = webContainerFeatureFactory.getSSOFactory();
//SingleSignOn sso = ssoFactory.createSingleSignOnValve();
String vsName = this.getName();
SingleSignOn sso = ssoFactory.createSingleSignOnValve(vsName);
// set max idle time if given
ElementProperty idle =
vsBean.getElementPropertyByName(SSO_MAX_IDLE);
if (idle != null && idle.getValue() != null) {
_logger.fine("SSO entry max idle time set to: " +
idle.getValue());
int i = Integer.parseInt(idle.getValue());
sso.setMaxInactive(i);
}
// set expirer thread sleep time if given
ElementProperty expireTime =
vsBean.getElementPropertyByName(SSO_REAP_INTERVAL);
if (expireTime !=null && expireTime.getValue() != null) {
_logger.fine("SSO expire thread interval set to : " +
expireTime.getValue());
int i = Integer.parseInt(expireTime.getValue());
sso.setReapInterval(i);
}
// Remove existing SSO valve (if any), in case of a reconfig
Valve[] valves = getValves();
for (int i=0; valves!=null && i<valves.length; i++) {
if (valves[i] instanceof SingleSignOn) {
removeValve(valves[i]);
break;
}
}
addValve(sso);
} catch (Exception e) {
_logger.log(Level.WARNING, "webcontainer.ssobadconfig", e);
_logger.log(Level.WARNING, "webcontainer.ssodisabled",
getID());
}
}
|
void | configureVirtualServerState()Configures this VirtualServer with its state (on | off | disabled).
String stateValue = ON;
if (vsBean != null){
stateValue = vsBean.getState();
}
if ( ( !stateValue.equalsIgnoreCase(ON) )
&& (getName().equalsIgnoreCase(ADMIN_VS) ) ){
throw new java.lang.IllegalArgumentException(
"virtual-server "
+ ADMIN_VS + " state property cannot be modified");
}
if ( stateValue.equalsIgnoreCase(DISABLED) ) {
// state="disabled"
setIsDisabled(true);
} else if ( !ConfigBean.toBoolean( stateValue ) ) {
// state="off"
setIsOff(true);
} else {
setIsActive(true);
}
|
protected WebModuleConfig | createSystemDefaultWebModuleIfNecessary()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).
WebModuleConfig wmInfo = null;
//
// Add a default context only if one hasn't already been loaded
// and then too only if docroot is not null
//
String docroot = getAppBase();
if (getDefaultWebModuleID() == null && (findChild("") == null)
&& (docroot != null)) {
wmInfo = new WebModuleConfig();
WebModule wm = new WebModule();
wm.setName(Constants.DEFAULT_WEB_MODULE_NAME);
wm.setContextRoot("");
wm.setLocation(docroot);
wmInfo.setBean(wm);
wmInfo.setDescriptor(DOLLoadingContextFactory.getDefaultWebBundleDescriptor());
WebBundleDescriptor wbd = wmInfo.getDescriptor();
if ( wbd.getApplication() == null ) {
Application application = new Application();
application.setVirtual(true);
application.setName(Constants.DEFAULT_WEB_MODULE_NAME);
wbd.setApplication(application);
}
}
return wmInfo;
|
void | disableAccessLogging()Disables access logging for this virtual server, by removing its
accesslog valve from its pipeline.
removeValve(accessLogValve);
|
void | enableAccessLogging()Enables access logging for this virtual server, by adding its
accesslog valve to its pipeline, or starting its accesslog valve
if it is already present in the pipeline.
if (!isAccessLogValveActivated()) {
addValve(accessLogValve);
} else {
try {
if (accessLogValve.isStarted()) {
accessLogValve.stop();
}
accessLogValve.start();
} catch (LifecycleException le) {
_logger.log(Level.SEVERE,
"pewebcontainer.accesslog.reconfigure",
le);
}
}
|
protected WebModuleConfig | findWebModuleInJ2eeApp(com.sun.enterprise.config.serverbeans.Applications appsBean, java.lang.String id)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.
WebModuleConfig wmInfo = null;
int length = id.length();
// Check for ':' separator
int separatorIndex = id.indexOf(Constants.NAME_SEPARATOR);
if (separatorIndex == -1) {
// Check for '#' separator
separatorIndex = id.indexOf('#");
}
if (separatorIndex != -1) {
String appID = id.substring(0, separatorIndex);
String moduleID = id.substring(separatorIndex + 1);
J2eeApplication j2eeApp = appsBean.getJ2eeApplicationByName(appID);
if ((j2eeApp != null) && j2eeApp.isEnabled()) {
String location = j2eeApp.getLocation();
String moduleDir =
DeploymentUtils.getRelativeEmbeddedModulePath(
location, moduleID);
ApplicationRegistry registry =
ApplicationRegistry.getInstance();
ClassLoader appLoader =
registry.getClassLoaderForApplication(appID);
if (appLoader != null) {
Application appDesc = registry.getApplication(appLoader);
if (appDesc != null) {
Set wbds = appDesc.getWebBundleDescriptors();
WebBundleDescriptor wbd = null;
for (Iterator itr = wbds.iterator(); itr.hasNext(); ) {
wbd = (WebBundleDescriptor) itr.next();
String webUri = wbd.getModuleDescriptor().getArchiveUri();
if (moduleID.equals(webUri)) {
StringBuffer dir = new StringBuffer(location);
dir.append(File.separator);
dir.append(moduleDir);
WebModule wm = new WebModule();
wm.setName(moduleID);
wm.setContextRoot(wbd.getContextRoot());
wm.setLocation(dir.toString());
wm.setEnabled(true);
String vsList = getVirtualServers(j2eeApp.getName());
wmInfo = new WebModuleConfig();
wmInfo.setBean(wm);
wmInfo.setDescriptor(wbd);
wmInfo.setParentLoader(appLoader);
wmInfo.setVirtualServers(vsList);
break;
}
}
}
}
} else {
Object[] params = { id, getID() };
_logger.log(Level.SEVERE, "vs.defaultWebModuleDisabled",
params);
}
}
return wmInfo;
|
PEAccessLogValve | getAccessLogValve()
return accessLogValve;
|
public boolean | getAllowLinking()Gets the value of the allowLinking property of this virtual server.
return allowLinking;
|
java.lang.String | getAuthRealmName()Gets the value of the authRealm property of this virtual server.
return authRealmName;
|
public com.sun.enterprise.config.serverbeans.VirtualServer | getBean()Gets the config bean associated with this VirtualServer.
return vsBean;
|
public java.lang.String[] | getCacheControls()Gets the Cache-Control configuration of this VirtualServer.
return cacheControls;
|
protected java.lang.String | getDefaultContextPath(com.sun.enterprise.config.serverbeans.Server serverBean)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}".
String contextRoot = null;
Applications appsBean = null;
try{
appsBean = ServerBeansFactory.getApplicationsBean(
serverBean.getConfigContext());
} catch (ConfigException e) {
String msg = _rb.getString("vs.appsConfigError");
Object[] params = { getID() };
msg = MessageFormat.format(msg, params);
_logger.log(Level.SEVERE, msg, e);
}
String wmID = getDefaultWebModuleID();
if (wmID != null) {
// Check if the default-web-module is part of a
// j2ee-application
WebModuleConfig wmInfo = findWebModuleInJ2eeApp(appsBean, wmID);
// Look up the list of standalone web modules
if (wmInfo == null) {
WebModule wm = appsBean.getWebModuleByName(wmID);
if (wm != null) {
if (isActive(wm, false)) {
// Create a copy as we need to change the name
// and context root to indicate that this web module
// is to be loaded as the 'default' web module for
// the virtual server
// WebModule wmCopy = (WebModule) wm.clone();
contextRoot = wm.getContextRoot();
} else {
Object[] params = { wmID, getID() };
_logger.log(Level.SEVERE, "vs.defaultWebModuleDisabled",
params);
}
}
} else {
WebModule wm = wmInfo.getBean();
contextRoot = wm.getContextRoot();
}
if (contextRoot == null) {
Object[] params = { wmID, getID() };
_logger.log(Level.SEVERE, "vs.defaultWebModuleNotFound",
params);
}
}
return contextRoot;
|
public java.lang.String | getDefaultContextXmlLocation()Gets the default-context.xml location of web modules deployed on this
virtual server.
return defaultContextXmlLocation;
|
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.
This is an optional attribute.
String wmID = null;
if (vsBean != null) {
wmID = vsBean.getDefaultWebModule();
if (wmID != null && _debug) {
Object[] params = { wmID, _id };
_logger.log(Level.FINE, "vs.defaultWebModule", params);
}
} else {
_logger.log(Level.SEVERE, "vs.configError", _id);
}
return wmID;
|
public java.lang.String | getDefaultWebXmlLocation()Gets the default-web.xml location of web modules deployed on this
virtual server.
return defaultWebXmlLocation;
|
public java.lang.String | getID()Return the virtual server identifier.
// ------------------------------------------------------------- Properties
return _id;
|
public java.lang.String | getInfo()Return descriptive information about this Container implementation and
the corresponding version number, in the format
<description>/<version> .
return _info;
|
public MimeMap | getMimeMap()Gets the mime map associated with this VirtualServer.
return mimeMap;
|
public com.sun.enterprise.web.stats.PWCRequestStatsImpl | getPWCRequestStatsImpl()Get the Stat holder.
return pwcRequestStatsImpl;
|
com.sun.enterprise.config.serverbeans.ElementProperty[] | getProperties()
if (vsBean != null) {
return vsBean.getElementProperty();
} else {
return null;
}
|
private java.lang.String | getVirtualServers(java.lang.String appName)Virtual servers are maintained in the reference contained
in Server element. First, we need to find the server
and then get the virtual server from the correct reference
String ret = null;
try {
ConfigContext ctx =
ApplicationServer.getServerContext().getConfigContext();
ret = ServerBeansFactory
.getVirtualServersByAppName(ctx, appName);
} catch (ConfigException ce) {
_logger.log(Level.FINE, "Cannot get virtual server for " + appName, ce);
}
return ret;
|
protected java.util.List | getWebModules(com.sun.enterprise.config.serverbeans.Server serverBean, java.lang.String modulesRoot)Return the list of enabled web-modules configured for this
virtual server.
List modules = new Vector();
//ROB: config changes
//Applications appsBean = serverBean.getApplications();
Applications appsBean = null;
try {
appsBean = ServerBeansFactory.getApplicationsBean(serverBean.getConfigContext());
} catch (ConfigException e) {
String msg = _rb.getString("vs.appsConfigError");
Object[] params = { getID() };
msg = MessageFormat.format(msg, params);
_logger.log(Level.SEVERE, msg, e);
}
if (appsBean != null) {
WebModule[] wmBeans = appsBean.getWebModule();
if (wmBeans != null && wmBeans.length > 0) {
for (int i = 0; i < wmBeans.length; i++) {
WebModule wm = wmBeans[i];
if (isActive(wm)) {
// skips if the web module is not referenced by
// this server
ApplicationRef ref =
serverBean.getApplicationRefByRef(wm.getName());
if (ref == null) {
continue;
}
String location = wm.getLocation();
// If module root is relative then prefix it with the
// location of where all the standalone modules for
// this server instance are deployed
File moduleBase = new File(location);
if (!moduleBase.isAbsolute()) {
location = modulesRoot+File.separator+location;
wm.setLocation(location);
}
WebModuleConfig wmInfo = loadWebModuleConfig(wm);
if (wmInfo != null)
modules.add(wmInfo);
} else {
if (_debug) {
_logger.finer("Web Module [" + wm.getName() +
"] is not applicable for virtual " +
" server [" + getID() + "]");
}
}
}
}
}
return modules;
|
private boolean | isAccessLogValveActivated()
Pipeline p = getPipeline();
if (p != null) {
Valve[] valves = p.getValves();
if (valves != null) {
for (int i=0; i<valves.length; i++) {
if (valves[i] instanceof PEAccessLogValve) {
return true;
}
}
}
}
return false;
|
boolean | isAccessLoggingEnabled(boolean globalAccessLoggingEnabled)Determines whether access logging is enabled for this virtual server.
ElementProperty prop =
vsBean.getElementPropertyByName(Constants.ACCESS_LOGGING_ENABLED);
if (prop == null || prop.getValue() == null) {
return globalAccessLoggingEnabled;
} else {
return ConfigBean.toBoolean(prop.getValue());
}
|
private boolean | isActive(com.sun.enterprise.config.serverbeans.WebModule wm)Determines whether the specified web module is "active" under this
virtual server.
return isActive(wm, true);
|
protected boolean | isActive(com.sun.enterprise.config.serverbeans.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
String vsID = getID();
boolean active = ((vsID != null) && (vsID.length() > 0));
active &= (wm != null);
if (active) {
// Check if the web module is enabled
active &= wm.isEnabled();
//
// Check if vsID is one of the virtual servers specified
// in the list of virtual servers that the web module is to
// be loaded on. If the virtual-servers attribute of the
// <web-module> element is missing or empty then the implied
// behaviour is that the web module is active on every virtual
// server.
//
String vsIDs = getVirtualServers(wm.getName());
//
// fix for bug# 4913636
// so that for PE if the vsList is null and the virtual server is
// admin-vs then return false because we don't want to load user apps
// on admin-vs
//
if (getID().equals(ADMIN_VS) && matchVSID
&& ((vsIDs == null) || (vsIDs.length() == 0 ))) {
return false;
}
if (matchVSID && (vsIDs != null) && (vsIDs.length() > 0)) {
List vsList = StringUtils.parseStringList(vsIDs, " ,");
if (vsList != null)
active &= vsList.contains(vsID.trim());
else
active &= true;
} else
active &= true;
}
return active;
|
public boolean | isActive()
return isActive;
|
private boolean | isSSOEnabled(boolean globalSSOEnabled)Checks if SSO is enabled for this VirtualServer.
ElementProperty ssoProperty =
vsBean.getElementPropertyByName(Constants.SSO_ENABLED);
if (ssoProperty == null || ssoProperty.getValue() == null) {
return globalSSOEnabled;
} else {
return ConfigBean.toBoolean(ssoProperty.getValue());
}
|
private java.lang.Object | loadInstance(java.lang.String className)
try{
Class clazz = Class.forName(className);
return clazz.newInstance();
} catch (Throwable ex){
_logger.log(Level.SEVERE,"webcontainer.unableToLoadExtension",ex);
}
return null;
|
protected WebModuleConfig | loadWebModuleConfig(com.sun.enterprise.config.serverbeans.WebModule wm)Creates and returns an object that contains information about
the web module's configuration such as the information specified
in server.xml, the deployment descriptor objects etc.
WebModuleConfig wmInfo = new WebModuleConfig();
wmInfo.setBean(wm);
String wmID = wm.getName();
String location = wm.getLocation();
try {
WebModulesManager webModulesManager = new WebModulesManager(
ApplicationServer.getServerContext().getInstanceEnvironment());
Application app = webModulesManager.getDescriptor(wmID, location);
WebBundleDescriptor wbd = (WebBundleDescriptor) app.getStandaloneBundleDescriptor();
wmInfo.setDescriptor(wbd);
} catch (ConfigException ce) {
wmInfo = null;
String msg = _rb.getString("vs.moduleConfigError");
Object[] params = { wmID, getID() };
msg = MessageFormat.format(msg, params);
_logger.log(Level.SEVERE, msg, ce);
}
return wmInfo;
|
void | reconfigureAccessLog(java.lang.String globalAccessLogBufferSize, java.lang.String globalAccessLogWriteInterval, com.sun.enterprise.instance.InstanceEnvironment instance, com.sun.enterprise.config.serverbeans.Domain domain, boolean globalAccessLoggingEnabled)Reconfigures the access log of this VirtualServer with its
updated access log related properties.
try {
if (accessLogValve.isStarted()) {
accessLogValve.stop();
}
boolean start = accessLogValve.updateVirtualServerProperties(
vsBean.getId(), vsBean, domain, instance,
globalAccessLogBufferSize, globalAccessLogWriteInterval);
if (start && isAccessLoggingEnabled(globalAccessLoggingEnabled)) {
enableAccessLogging();
} else {
disableAccessLogging();
}
} catch (LifecycleException le) {
_logger.log(Level.SEVERE,
"pewebcontainer.accesslog.reconfigure",
le);
}
|
void | reconfigureAccessLog(com.sun.enterprise.config.serverbeans.HttpService httpService, com.sun.enterprise.server.pluggable.WebContainerFeatureFactory webcontainerFeatureFactory)Reconfigures the access log of this VirtualServer with the
updated attributes of the access-log element from domain.xml.
try {
boolean restart = false;
if (accessLogValve.isStarted()) {
accessLogValve.stop();
restart = true;
}
accessLogValve.updateAccessLogAttributes(
httpService,
webcontainerFeatureFactory);
if (restart) {
accessLogValve.start();
}
} catch (LifecycleException le) {
_logger.log(Level.SEVERE,
"pewebcontainer.accesslog.reconfigure",
le);
}
|
public synchronized void | removeValve(org.apache.catalina.Valve valve)Removes the given valve from the currently active pipeline, keeping the
valve that is not currently active in sync.
super.removeValve(valve);
if (pipeline == vsPipeline) {
origPipeline.removeValve(valve);
} else {
vsPipeline.removeValve(valve);
}
|
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.
this.allowLinking = allowLinking;
|
public void | setBean(com.sun.enterprise.config.serverbeans.VirtualServer vsBean)Sets the config bean for this VirtualServer
this.vsBean = vsBean;
|
public void | setCacheControls(java.lang.String[] cacheControls)Sets the Cache-Control configuration for this VirtualServer
this.cacheControls = cacheControls;
|
public void | setDefaultContextXmlLocation(java.lang.String defaultContextXmlLocation)Sets the default-context.xml location for web modules deployed on this
virtual server.
this.defaultContextXmlLocation = defaultContextXmlLocation;
|
public void | setDefaultWebXmlLocation(java.lang.String defaultWebXmlLocation)Sets the default-web.xml location for web modules deployed on this
virtual server.
this.defaultWebXmlLocation = defaultWebXmlLocation;
|
public void | setID(java.lang.String id)Set the virtual server identifier string.
_id = id;
|
public void | setIsActive(boolean isActive)Sets the state of this virtual server.
this.isActive = isActive;
if (isActive) {
vsPipeline.setIsDisabled(false);
vsPipeline.setIsOff(false);
if (pipeline == vsPipeline && !vsPipeline.hasRedirects()) {
// Restore original pipeline
setPipeline(origPipeline);
}
}
|
private void | setIsDisabled(boolean isDisabled)
vsPipeline.setIsDisabled(isDisabled);
vsPipeline.setIsOff(false);
if (isDisabled && pipeline != vsPipeline) {
// Enable custom pipeline
setPipeline(vsPipeline);
}
|
private void | setIsOff(boolean isOff)
vsPipeline.setIsOff(isOff);
vsPipeline.setIsDisabled(false);
if (isOff && pipeline != vsPipeline) {
// Enable custom pipeline
setPipeline(vsPipeline);
}
|
public void | setMimeMap(MimeMap mimeMap)Sets the mime map for this VirtualServer
this.mimeMap = mimeMap;
|
public void | setPWCRequestStatsImpl(com.sun.enterprise.web.stats.PWCRequestStatsImpl pwcRequestStatsImpl)Set the Stat holder.
this.pwcRequestStatsImpl = pwcRequestStatsImpl;
|
protected void | startChildren()Starts the children (web contexts) of this virtual server
concurrently.
ArrayList<LifecycleStarter> starters
= new ArrayList<LifecycleStarter>();
Container children[] = findChildren();
for (int i = 0; i < children.length; i++) {
if (children[i] instanceof Lifecycle) {
LifecycleStarter starter =
new LifecycleStarter(((Lifecycle) children[i]));
starters.add(starter);
starter.submit();
}
}
for (LifecycleStarter starter : starters) {
Throwable t = starter.waitDone();
if (t != null) {
Lifecycle container = starter.getContainer();
((Context) container).setAvailable(false);
String msg = _rb.getString("vs.startContextError");
msg = MessageFormat.format(msg,
new Object[] { container,
getID() });
_logger.log(Level.SEVERE, msg, t);
}
}
|
public synchronized void | stop()Gracefully shut down active use of the public methods of this Component.
super.stop();
// Remove the descriptor bindings for all the web applications
// in this virtual server
Switch sw = Switch.getSwitch();
Container children[] = findChildren();
if (children != null) {
for (int i = 0; i < children.length; i++) {
sw.removeDescriptorFor(children[i]);
}
}
|