remm 01/01/20 11:41:30
Modified: catalina/src/share/org/apache/catalina/core
StandardContext.java StandardHost.java
Log:
- StandardContext will now use the new WARDirContext if the url given ends
with ".war".
- Add a new "unpackWARs" flag in the StandardHost : if true, the host will
deploy WARs as before. If false, the WARs found in the host path won't
be unpacked and the WARDirContext will be used.
Revision Changes Path
1.37 +12 -6
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardContext.java
Index: StandardContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- StandardContext.java 2001/01/14 19:58:30 1.36
+++ StandardContext.java 2001/01/20 19:41:29 1.37
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.36 2001/01/14 19:58:30 remm Exp $
- * $Revision: 1.36 $
- * $Date: 2001/01/14 19:58:30 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.37 2001/01/20 19:41:29 remm Exp $
+ * $Revision: 1.37 $
+ * $Date: 2001/01/20 19:41:29 $
*
* ====================================================================
*
@@ -97,6 +97,7 @@
import org.apache.naming.ResourceEnvRef;
import org.apache.naming.TransactionRef;
import org.apache.naming.resources.FileDirContext;
+import org.apache.naming.resources.WARDirContext;
import org.apache.naming.resources.BaseDirContext;
import org.apache.catalina.Container;
import org.apache.catalina.ContainerListener;
@@ -136,7 +137,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.36 $ $Date: 2001/01/14 19:58:30 $
+ * @version $Revision: 1.37 $ $Date: 2001/01/20 19:41:29 $
*/
public class StandardContext
@@ -2911,7 +2912,10 @@
if (getResources() == null) { // (1) Required by Loader
if (debug >= 1)
log("Configuring default Resources");
- setResources(new FileDirContext());
+ if ((docBase != null) && (docBase.endsWith(".war")))
+ setResources(new WARDirContext());
+ else
+ setResources(new FileDirContext());
}
if (getLoader() == null) { // (2) Required by Manager
if (debug >= 1)
@@ -2924,6 +2928,9 @@
setManager(new StandardManager());
}
+ // Post work directory
+ postWorkDirectory();
+
// Standard container startup
if (debug >= 1)
log("Processing standard container startup");
@@ -2961,7 +2968,6 @@
if (debug >= 1)
log("Posting standard context attributes");
postWelcomeFiles();
- postWorkDirectory();
// Reload sessions from persistent storage if supported
try {
1.7 +64 -21
jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardHost.java
Index: StandardHost.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StandardHost.java 2000/12/07 19:37:41 1.6
+++ StandardHost.java 2001/01/20 19:41:29 1.7
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
1.6 2000/12/07 19:37:41 pier Exp $
- * $Revision: 1.6 $
- * $Date: 2000/12/07 19:37:41 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.1/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
1.7 2001/01/20 19:41:29 remm Exp $
+ * $Revision: 1.7 $
+ * $Date: 2001/01/20 19:41:29 $
*
* ====================================================================
*
@@ -97,7 +97,7 @@
* requests directed to a particular web application.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2000/12/07 19:37:41 $
+ * @version $Revision: 1.7 $ $Date: 2001/01/20 19:41:29 $
*/
public class StandardHost
@@ -173,6 +173,12 @@
"org.apache.catalina.core.StandardHostMapper";
+ /**
+ * Unpack WARs property.
+ */
+ private boolean unpackWARs = true;
+
+
// ------------------------------------------------------------- Properties
@@ -290,6 +296,26 @@
}
+ /**
+ * Unpack WARs flag accessor.
+ */
+ public boolean isUnpackWARs() {
+
+ return (unpackWARs);
+
+ }
+
+
+ /**
+ * Unpack WARs flag mutator.
+ */
+ public void setUnpackWARs(boolean unpackWARs) {
+
+ this.unpackWARs = unpackWARs;
+
+ }
+
+
// --------------------------------------------------------- Public Methods
@@ -513,22 +539,39 @@
log(sm.getString("standardHost.deploying", contextPath, url));
// Expand a WAR archive into an unpacked directory if needed
- if (url.startsWith("jar:"))
- docBase = expand(war);
- else if (url.startsWith("file://"))
- docBase = url.substring(7);
- else if (url.startsWith("file:"))
- docBase = url.substring(5);
- else
- throw new IllegalArgumentException
- (sm.getString("standardHost.warURL", url));
-
- // Make sure the document base directory exists and is readable
- File docBaseDir = new File(docBase);
- if (!docBaseDir.exists() || !docBaseDir.isDirectory() ||
- !docBaseDir.canRead())
- throw new IllegalArgumentException
- (sm.getString("standardHost.accessBase", docBase));
+ if (isUnpackWARs()) {
+
+ if (url.startsWith("jar:"))
+ docBase = expand(war);
+ else if (url.startsWith("file://"))
+ docBase = url.substring(7);
+ else if (url.startsWith("file:"))
+ docBase = url.substring(5);
+ else
+ throw new IllegalArgumentException
+ (sm.getString("standardHost.warURL", url));
+
+ // Make sure the document base directory exists and is readable
+ File docBaseDir = new File(docBase);
+ if (!docBaseDir.exists() || !docBaseDir.isDirectory() ||
+ !docBaseDir.canRead())
+ throw new IllegalArgumentException
+ (sm.getString("standardHost.accessBase", docBase));
+
+ } else {
+
+ if (url.startsWith("jar:")) {
+ url = url.substring(4, url.length() - 2);
+ }
+ if (url.startsWith("file://"))
+ docBase = url.substring(7);
+ else if (url.startsWith("file:"))
+ docBase = url.substring(5);
+ else
+ throw new IllegalArgumentException
+ (sm.getString("standardHost.warURL", url));
+
+ }
// Deploy this new web application
try {
@@ -544,7 +587,7 @@
}
addChild(context);
fireContainerEvent(DEPLOY_EVENT, context);
- if (url.startsWith("jar:")) {
+ if (isUnpackWARs() && (url.startsWith("jar:"))) {
synchronized (expanded) {
if (debug >= 1)
log("Recording expanded app at path " + contextPath);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]