📄 standardhost.java
字号:
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.core;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Host;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Valve;
import org.apache.catalina.startup.HostConfig;
import org.apache.catalina.valves.ValveBase;
import org.apache.tomcat.util.modeler.Registry;
/**
* Standard implementation of the <b>Host</b> interface. Each
* child container must be a Context implementation to process the
* requests directed to a particular web application.
*
* @author Craig R. McClanahan
* @author Remy Maucherat
* @version $Revision: 497521 $ $Date: 2007-01-18 19:24:17 +0100 (jeu., 18 janv. 2007) $
*/
public class StandardHost
extends ContainerBase
implements Host
{
/* Why do we implement deployer and delegate to deployer ??? */
private static org.apache.juli.logging.Log log=
org.apache.juli.logging.LogFactory.getLog( StandardHost.class );
// ----------------------------------------------------------- Constructors
/**
* Create a new StandardHost component with the default basic Valve.
*/
public StandardHost() {
super();
pipeline.setBasic(new StandardHostValve());
}
// ----------------------------------------------------- Instance Variables
/**
* The set of aliases for this Host.
*/
private String[] aliases = new String[0];
/**
* The application root for this Host.
*/
private String appBase = ".";
/**
* The auto deploy flag for this Host.
*/
private boolean autoDeploy = true;
/**
* The Java class name of the default context configuration class
* for deployed web applications.
*/
private String configClass =
"org.apache.catalina.startup.ContextConfig";
/**
* The Java class name of the default Context implementation class for
* deployed web applications.
*/
private String contextClass =
"org.apache.catalina.core.StandardContext";
/**
* The deploy on startup flag for this Host.
*/
private boolean deployOnStartup = true;
/**
* deploy Context XML config files property.
*/
private boolean deployXML = true;
/**
* The Java class name of the default error reporter implementation class
* for deployed web applications.
*/
private String errorReportValveClass =
"org.apache.catalina.valves.ErrorReportValve";
/**
* The object name for the errorReportValve.
*/
private ObjectName errorReportValveObjectName = null;
/**
* The descriptive information string for this implementation.
*/
private static final String info =
"org.apache.catalina.core.StandardHost/1.0";
/**
* The live deploy flag for this Host.
*/
private boolean liveDeploy = true;
/**
* Unpack WARs property.
*/
private boolean unpackWARs = true;
/**
* Work Directory base for applications.
*/
private String workDir = null;
/**
* Attribute value used to turn on/off XML validation
*/
private boolean xmlValidation = false;
/**
* Attribute value used to turn on/off XML namespace awarenes.
*/
private boolean xmlNamespaceAware = false;
// ------------------------------------------------------------- Properties
/**
* Return the application root for this Host. This can be an absolute
* pathname, a relative pathname, or a URL.
*/
public String getAppBase() {
return (this.appBase);
}
/**
* Set the application root for this Host. This can be an absolute
* pathname, a relative pathname, or a URL.
*
* @param appBase The new application root
*/
public void setAppBase(String appBase) {
String oldAppBase = this.appBase;
this.appBase = appBase;
support.firePropertyChange("appBase", oldAppBase, this.appBase);
}
/**
* Return the value of the auto deploy flag. If true, it indicates that
* this host's child webapps will be dynamically deployed.
*/
public boolean getAutoDeploy() {
return (this.autoDeploy);
}
/**
* Set the auto deploy flag value for this host.
*
* @param autoDeploy The new auto deploy flag
*/
public void setAutoDeploy(boolean autoDeploy) {
boolean oldAutoDeploy = this.autoDeploy;
this.autoDeploy = autoDeploy;
support.firePropertyChange("autoDeploy", oldAutoDeploy,
this.autoDeploy);
}
/**
* Return the Java class name of the context configuration class
* for new web applications.
*/
public String getConfigClass() {
return (this.configClass);
}
/**
* Set the Java class name of the context configuration class
* for new web applications.
*
* @param configClass The new context configuration class
*/
public void setConfigClass(String configClass) {
String oldConfigClass = this.configClass;
this.configClass = configClass;
support.firePropertyChange("configClass",
oldConfigClass, this.configClass);
}
/**
* Return the Java class name of the Context implementation class
* for new web applications.
*/
public String getContextClass() {
return (this.contextClass);
}
/**
* Set the Java class name of the Context implementation class
* for new web applications.
*
* @param contextClass The new context implementation class
*/
public void setContextClass(String contextClass) {
String oldContextClass = this.contextClass;
this.contextClass = contextClass;
support.firePropertyChange("contextClass",
oldContextClass, this.contextClass);
}
/**
* Return the value of the deploy on startup flag. If true, it indicates
* that this host's child webapps should be discovred and automatically
* deployed at startup time.
*/
public boolean getDeployOnStartup() {
return (this.deployOnStartup);
}
/**
* Set the deploy on startup flag value for this host.
*
* @param deployOnStartup The new deploy on startup flag
*/
public void setDeployOnStartup(boolean deployOnStartup) {
boolean oldDeployOnStartup = this.deployOnStartup;
this.deployOnStartup = deployOnStartup;
support.firePropertyChange("deployOnStartup", oldDeployOnStartup,
this.deployOnStartup);
}
/**
* Deploy XML Context config files flag accessor.
*/
public boolean isDeployXML() {
return (deployXML);
}
/**
* Deploy XML Context config files flag mutator.
*/
public void setDeployXML(boolean deployXML) {
this.deployXML = deployXML;
}
/**
* Return the value of the live deploy flag. If true, it indicates that
* a background thread should be started that looks for web application
* context files, WAR files, or unpacked directories being dropped in to
* the <code>appBase</code> directory, and deploys new ones as they are
* encountered.
*/
public boolean getLiveDeploy() {
return (this.autoDeploy);
}
/**
* Set the live deploy flag value for this host.
*
* @param liveDeploy The new live deploy flag
*/
public void setLiveDeploy(boolean liveDeploy) {
setAutoDeploy(liveDeploy);
}
/**
* Return the Java class name of the error report valve class
* for new web applications.
*/
public String getErrorReportValveClass() {
return (this.errorReportValveClass);
}
/**
* Set the Java class name of the error report valve class
* for new web applications.
*
* @param errorReportValveClass The new error report valve class
*/
public void setErrorReportValveClass(String errorReportValveClass) {
String oldErrorReportValveClassClass = this.errorReportValveClass;
this.errorReportValveClass = errorReportValveClass;
support.firePropertyChange("errorReportValveClass",
oldErrorReportValveClassClass,
this.errorReportValveClass);
}
/**
* Return the canonical, fully qualified, name of the virtual host
* this Container represents.
*/
public String getName() {
return (name);
}
/**
* Set the canonical, fully qualified, name of the virtual host
* this Container represents.
*
* @param name Virtual host name
*
* @exception IllegalArgumentException if name is null
*/
public void setName(String name) {
if (name == null)
throw new IllegalArgumentException
(sm.getString("standardHost.nullName"));
name = name.toLowerCase(); // Internally all names are lower case
String oldName = this.name;
this.name = name;
support.firePropertyChange("name", oldName, this.name);
}
/**
* Unpack WARs flag accessor.
*/
public boolean isUnpackWARs() {
return (unpackWARs);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -