/**
+ * Return the XML root for this Host. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ * If null, defaults to ${catalina.base}/conf/ directory
+ */
+ public String getXmlBase();
+
+ /**
+ * Set the Xml root for this Host. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ * If null, defaults to ${catalina.base}/conf/ directory
+ *
+ * @param xmlBase The new XML root
+ */
+ public void setXmlBase(String xmlBase);
+
+ /**
* Return the application root for this Host. This can be an absolute
* pathname, a relative pathname, or a URL.
*/
*/
private String appBase = ".";
+ /**
+ * The XML root for this Host.
+ */
+ private String xmlBase = null;
/**
* The auto deploy flag for this Host.
}
+ /**
+ * Return the XML root for this Host. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ * If null, defaults to ${catalina.base}/conf/ directory
+ */
+ public String getXmlBase() {
+
+ return (this.xmlBase);
+
+ }
/**
* Set the application root for this Host. This can be an absolute
support.firePropertyChange("appBase", oldAppBase, this.appBase);
}
+
+ /**
+ * Set the Xml root for this Host. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ * If null, defaults to ${catalina.base}/conf/ directory
+ *
+ * @param xmlBase The new XML root
+ */
+ public void setXmlBase(String xmlBase) {
+
+ String oldXmlBase = this.xmlBase;
+ this.xmlBase = xmlBase;
+ support.firePropertyChange("xmlBase", oldXmlBase, this.xmlBase);
+
+ }
/**
setUnpackWARs(((StandardHost) host).isUnpackWARs());
setXmlNamespaceAware(((StandardHost) host).getXmlNamespaceAware());
setXmlValidation(((StandardHost) host).getXmlValidation());
+ if (((StandardHost) host).getXmlBase()!=null) {
+
+ }
}
} catch (ClassCastException e) {
log.error(sm.getString("hostConfig.cce", event.getLifecycle()), e);
return (digester);
}
+ protected File returnCanonicalPath(String path) {
+ File file = new File(path);
+ File base = new File(System.getProperty("catalina.base"));
+ if (!file.isAbsolute())
+ file = new File(base,path);
+ try {
+ return file.getCanonicalFile();
+ } catch (IOException e) {
+ return file;
+ }
+ }
+
/**
* Return a File object representing the "application root" directory
if (appBase != null) {
return appBase;
}
-
- File file = new File(host.getAppBase());
- if (!file.isAbsolute())
- file = new File(System.getProperty("catalina.base"),
- host.getAppBase());
- try {
- appBase = file.getCanonicalFile();
- } catch (IOException e) {
- appBase = file;
- }
- return (appBase);
+
+ appBase = returnCanonicalPath(host.getAppBase());
+ return appBase;
}
if (configBase != null) {
return configBase;
}
-
- File file = new File(System.getProperty("catalina.base"), "conf");
- Container parent = host.getParent();
- if ((parent != null) && (parent instanceof Engine)) {
- file = new File(file, parent.getName());
- }
- file = new File(file, host.getName());
- try {
- configBase = file.getCanonicalFile();
- } catch (IOException e) {
- configBase = file;
+
+ if (host.getXmlBase()!=null) {
+ configBase = returnCanonicalPath(host.getXmlBase());
+ } else {
+ configBase = returnCanonicalPath("conf");
}
return (configBase);
InputStream istream = null;
BufferedOutputStream ostream = null;
File xml = new File
- (configBase, file.substring(0, file.lastIndexOf(".")) + ".xml");
+ (configBase(), file.substring(0, file.lastIndexOf(".")) + ".xml");
if (deployXML && !xml.exists()) {
try {
jar = new JarFile(war);
if (entry != null) {
istream = jar.getInputStream(entry);
- configBase.mkdirs();
+ configBase().mkdirs();
ostream =
new BufferedOutputStream
digester.reset();
}
}
- configBase.mkdirs();
- File xmlCopy = new File(configBase, file + ".xml");
+ configBase().mkdirs();
+ File xmlCopy = new File(configBase(), file + ".xml");
InputStream is = null;
OutputStream os = null;
try {
Deployment</a> for more information on automatic recognition and
deployment of web applications to be deployed automatically.</p>
</attribute>
+
+ <attribute name="xmlBase" required="false">
+ <p>The <em>XML Base</em> directory for this virtual host.
+ This is the pathname of a directory that may contain context XML descriptors
+ to be deployed on this virtual host. You may specify an
+ absolute pathname for this directory, or a pathname that is relative
+ to the <code>$CATALINA_BASE</code> directory. See
+ <a href="#Automatic Application Deployment">Automatic Application
+ Deployment</a> for more information on automatic recognition and
+ deployment of web applications to be deployed automatically.</p>
+ </attribute>
<attribute name="autoDeploy" required="false">
<p>This flag value indicates if new web applications, dropped in to
applications from interacting with the container's configuration. The
administrator will then be responsible for providing an external context
configuration file, and put it in
- <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code>.
+ <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> unless the attribute <code>xmlBase</code> is specified.
The flag's value defaults to <code>true</code>.</p>
</attribute>