cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2004/03/22 03:50:11 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Due to the use of the '#' special char to replace '/', the URL must be handled in a special way. - Bug 27752. Revision ChangesPath 1.22 +17 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- StandardHostDeployer.java 29 Feb 2004 22:47:21 - 1.21 +++ StandardHostDeployer.java 22 Mar 2004 11:50:11 - 1.22 @@ -19,6 +19,7 @@ import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -461,13 +462,25 @@ // Install the new web application this.overrideDocBase = docBase; -if (config.toString().startsWith(file:)) { -this.overrideConfigFile = config.getFile(); +String configPath = config.toString(); +if (configPath.startsWith(file:)) { +if (configPath.startsWith(file://)) { +configPath = configPath.substring(7); +} else { +configPath = configPath.substring(5); +} +this.overrideConfigFile = (new File(configPath)).getAbsolutePath(); +} else { +configPath = null; } InputStream stream = null; try { -stream = config.openStream(); +if (configPath == null) { +stream = config.openStream(); +} else { +stream = new FileInputStream(configPath); +} Digester digester = createDigester(); digester.setClassLoader(this.getClass().getClassLoader()); digester.clear(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2004/02/29 14:47:21 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Reuse already existing util code. Revision ChangesPath 1.21 +3 -27 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- StandardHostDeployer.java 27 Feb 2004 14:58:42 - 1.20 +++ StandardHostDeployer.java 29 Feb 2004 22:47:21 - 1.21 @@ -649,7 +649,7 @@ long contextLastModified = contextFile.lastModified(); if (contextFile.isDirectory()) { -deleteDir(contextFile); +ExpandWar.deleteDir(contextFile); } if (host.isUnpackWARs()) { File contextWAR = @@ -678,7 +678,7 @@ workDir = new File(((StandardContext)context).getWorkPath()); } if (workDir != null workDir.exists()) { -deleteDir(workDir); +ExpandWar.deleteDir(workDir); } } @@ -828,29 +828,5 @@ } - -/** - * Delete the specified directory, including all of its contents and - * subdirectories recursively. - * - * @param dir File object representing the directory to be deleted - */ -protected void deleteDir(File dir) { - -String files[] = dir.list(); -if (files == null) { -files = new String[0]; -} -for (int i = 0; i files.length; i++) { -File file = new File(dir, files[i]); -if (file.isDirectory()) { -deleteDir(file); -} else { -file.delete(); -} -} -dir.delete(); - -} } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
It isn't beyond the realm of possibility that I am doing something stupid. This is what I did. Whilst looking into bug11682 I created a very simple web app (just index.jsp) made a war and then tried to deploy it via ant. I modified the build.xml from the manager how-to and added the task below. When using the deploy target, the results were as described previously. The root cause of the problem is that ExpandWar.expand doesn't do anything if the context path is an empty string. Hope this clarifies things. Mark target name=deploy description=Deploy web application deploy url=${url} username=${username} password=${password} path= war=file:///C:\\javadev\\bugsopen\\bug11682\\build\\bug11682.war / /target On Wednesday, January 07, 2004 5:35 AM, Remy Maucherat [SMTP:[EMAIL PROTECTED] wrote: Mark Thomas wrote: When I tested the deploy task, the behaviour I saw was that the original codedocBase = ExpandWar.expand(host, war, contextPath)code; failed to create any files at all in the webapp directory. The root context _was_ displayed in the manager app but when I tried to access it all I saw was a directory listing for the webapp directory. Hmmm, maybe, I still don't quite see the problem. Can I get an example of a deploy command which would fail ? Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
Mark Thomas wrote: It isn't beyond the realm of possibility that I am doing something stupid. This is what I did. Whilst looking into bug11682 I created a very simple web app (just index.jsp) made a war and then tried to deploy it via ant. I modified the build.xml from the manager how-to and added the task below. When using the deploy target, the results were as described previously. The root cause of the problem is that ExpandWar.expand doesn't do anything if the context path is an empty string. Hope this clarifies things. Mark target name=deploy description=Deploy web application deploy url=${url} username=${username} password=${password} path= war=file:///C:\\javadev\\bugsopen\\bug11682\\build\\bug11682.war / /target The idea is that when uploading a WAR, you'd have a .war with the right name, and no path attribute. Otherwise, you may have trouble after restarting. Maybe a context file gets saved in that case (this would avoid some of the trouble). I believe your war will get uploaded to webapps/bug11682.war, right ? The manager servlet should IMO be smart and rename your war to webapps/ROOT.war (this is simpler, and consistent with everything else, this way). I think I'll need to try it. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
What I found was the .war was uploaded to work\Standalone\localhost\bug11682 and then expanded to webapps. If I used a path of xyz then the .war was expanded to webapps\xyz regardless of the name of the .war Mark On Wednesday, January 07, 2004 8:41 PM, Remy Maucherat [SMTP:[EMAIL PROTECTED] wrote: Mark Thomas wrote: It isn't beyond the realm of possibility that I am doing something stupid. This is what I did. Whilst looking into bug11682 I created a very simple web app (just index.jsp) made a war and then tried to deploy it via ant. I modified the build.xml from the manager how-to and added the task below. When using the deploy target, the results were as described previously. The root cause of the problem is that ExpandWar.expand doesn't do anything if the context path is an empty string. Hope this clarifies things. Mark target name=deploy description=Deploy web application deploy url=${url} username=${username} password=${password} path= war=file:///C:\\javadev\\bugsopen\\bug11682\\build\\bug11682.war / /target The idea is that when uploading a WAR, you'd have a .war with the right name, and no path attribute. Otherwise, you may have trouble after restarting. Maybe a context file gets saved in that case (this would avoid some of the trouble). I believe your war will get uploaded to webapps/bug11682.war, right ? The manager servlet should IMO be smart and rename your war to webapps/ROOT.war (this is simpler, and consistent with everything else, this way). I think I'll need to try it. Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
Mark Thomas wrote: What I found was the .war was uploaded to work\Standalone\localhost\bug11682 and then expanded to webapps. If I used a path of xyz then the .war was expanded to webapps\xyz regardless of the name of the .war Ah ok. Nice :) (I didn't remember, but I did code that :) ) I think your patch is fine then. There is a second ExpandWar.expand which could use the same patch as well. I don't know if it's actually used, but it would be good to fix it anyway. Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
OK, will do. Mark On Wednesday, January 07, 2004 9:52 PM, Remy Maucherat [SMTP:[EMAIL PROTECTED] wrote: Mark Thomas wrote: What I found was the .war was uploaded to work\Standalone\localhost\bug11682 and then expanded to webapps. If I used a path of xyz then the .war was expanded to webapps\xyz regardless of the name of the .war Ah ok. Nice :) (I didn't remember, but I did code that :) ) I think your patch is fine then. There is a second ExpandWar.expand which could use the same patch as well. I don't know if it's actually used, but it would be good to fix it anyway. Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
markt 2004/01/07 15:34:31 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Apply same patch as for bug 11682 to second ExpandWar.expand() Revision ChangesPath 1.18 +6 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- StandardHostDeployer.java 6 Jan 2004 22:31:18 - 1.17 +++ StandardHostDeployer.java 7 Jan 2004 23:34:31 - 1.18 @@ -297,7 +297,11 @@ // Expand war file if host wants wars unpacked if (isWAR host.isUnpackWARs()) { -docBase = ExpandWar.expand(host, war, contextPath); +if (contextPath.equals()) { +docBase = ExpandWar.expand(host, war, /ROOT); +} else { +docBase = ExpandWar.expand(host, war, contextPath); +} } // Install the new web application - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
markt 2004/01/06 14:31:18 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Fix bug11682. Deploying a webapp to the root context via an Ant task when unpackWARs is true now behaves correctly. Revision ChangesPath 1.17 +6 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- StandardHostDeployer.java 14 Nov 2003 10:02:23 - 1.16 +++ StandardHostDeployer.java 6 Jan 2004 22:31:18 - 1.17 @@ -396,7 +396,11 @@ // Expand war file if host wants wars unpacked if (isWAR host.isUnpackWARs()) { -docBase = ExpandWar.expand(host, war, contextPath); +if (contextPath.equals()) { +docBase = ExpandWar.expand(host, war, /ROOT); +} else { +docBase = ExpandWar.expand(host, war, contextPath); +} } // Install the new web application - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
[EMAIL PROTECTED] wrote: markt 2004/01/06 14:31:18 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Fix bug11682. Deploying a webapp to the root context via an Ant task when unpackWARs is true now behaves correctly. Are you sure this was actually broken ? Note that the install task is deprecated (deploy should be used instead), so no fix is needed for that. Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
When I tested the deploy task, the behaviour I saw was that the original codedocBase = ExpandWar.expand(host, war, contextPath)code; failed to create any files at all in the webapp directory. The root context _was_ displayed in the manager app but when I tried to access it all I saw was a directory listing for the webapp directory. It was on this basis that I wrote the fix. Mark On Tuesday, January 06, 2004 10:41 PM, Remy Maucherat [SMTP:[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: markt 2004/01/06 14:31:18 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Fix bug11682. Deploying a webapp to the root context via an Ant task when unpackWARs is true now behaves correctly. Are you sure this was actually broken ? Note that the install task is deprecated (deploy should be used instead), so no fix is needed for that. Remy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
Mark Thomas wrote: When I tested the deploy task, the behaviour I saw was that the original codedocBase = ExpandWar.expand(host, war, contextPath)code; failed to create any files at all in the webapp directory. The root context _was_ displayed in the manager app but when I tried to access it all I saw was a directory listing for the webapp directory. Hmmm, maybe, I still don't quite see the problem. Can I get an example of a deploy command which would fail ? Rémy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2003/11/14 02:02:23 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Use the extended digester for system property replacement. - Note: Although the code is not very optimized, this does not have any impact on startup time, at least on my computer. Revision ChangesPath 1.16 +3 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- StandardHostDeployer.java 2 Sep 2003 21:22:04 - 1.15 +++ StandardHostDeployer.java 14 Nov 2003 10:02:23 - 1.16 @@ -79,6 +79,7 @@ import org.apache.catalina.startup.ContextRuleSet; import org.apache.catalina.startup.ExpandWar; import org.apache.catalina.startup.NamingRuleSet; +import org.apache.catalina.util.CatalinaDigester; import org.apache.catalina.util.StringManager; import org.apache.commons.digester.Digester; @@ -853,7 +854,7 @@ */ protected Digester createDigester() { if (digester == null) { -digester = new Digester(); +digester = new CatalinaDigester(); if (host.getDebug() 0) digester.setDebug(3); digester.setValidating(false); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2003/07/25 06:54:57 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Remove use of the auto deploy flag. Revision ChangesPath 1.14 +7 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- StandardHostDeployer.java 24 Jun 2003 22:37:33 - 1.13 +++ StandardHostDeployer.java 25 Jul 2003 13:54:57 - 1.14 @@ -282,7 +282,7 @@ // Make sure contextPath and directory/war names match when // installing from the host appBase -if (isAppBase (host.getAutoDeploy() || host.getLiveDeploy())) { +if (isAppBase host.getAutoDeploy()) { String filename = contextFile.getName(); if (isWAR) { filename = filename.substring(0,filename.length()-4); @@ -666,8 +666,9 @@ host.getAppBase()); File contextFile = new File(context.getDocBase()); File baseDir = contextFile.getParentFile(); -if (appBase.getCanonicalPath().equals -(baseDir.getCanonicalPath())) { +if ((baseDir == null) +|| (appBase.getCanonicalPath().equals +(baseDir.getCanonicalPath( { isAppBase = true; } @@ -676,9 +677,8 @@ isWAR = true; } // Only remove directory and/or war if they are located in the -// Host's appBase and autoDeploy or liveDeploy are true -if (isAppBase -(host.getAutoDeploy() || host.getLiveDeploy())) { +// Host's appBase autoDeploy is true +if (isAppBase host.getAutoDeploy()) { String filename = contextFile.getName(); if (isWAR) { filename = filename.substring(0,filename.length()-4); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2003/06/23 13:33:27 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Code cleanup. - Remove XML descriptor on undeploy (bug 19607). Revision ChangesPath 1.12 +16 -9 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- StandardHostDeployer.java 21 Jun 2003 20:00:23 - 1.11 +++ StandardHostDeployer.java 23 Jun 2003 20:33:27 - 1.12 @@ -128,6 +128,7 @@ */ private ContextRuleSet contextRuleSet = null; + /** * The codeDigester/code instance to use for deploying web applications * to this codeHost/code. strongWARNING/strong - Usage of this @@ -136,6 +137,7 @@ */ private Digester digester = null; + /** * The codeStandardHost/code instance we are associated with. */ @@ -411,7 +413,7 @@ // save context info into configFile Engine engine = (Engine)host.getParent(); StandardServer server = (StandardServer) engine.getService().getServer(); -server.storeContext(context); +//server.storeContext(context); } catch (Exception e) { log.error(sm.getString(standardHost.installError, contextPath), e); @@ -629,8 +631,10 @@ host.log(sm.getString(standardHost.removing, contextPath)); try { // Get the work directory for the Context -File workDir = (File) -context.getServletContext().getAttribute(Globals.WORK_DIR_ATTR); +File workDir = +(File) context.getServletContext().getAttribute +(Globals.WORK_DIR_ATTR); +String configFile = context.getConfigFile(); host.removeChild(context); if (undeploy) { @@ -645,7 +649,8 @@ host.getAppBase()); File contextFile = new File(context.getDocBase()); File baseDir = contextFile.getParentFile(); -if (appBase.getCanonicalPath().equals(baseDir.getCanonicalPath())) { +if (appBase.getCanonicalPath().equals +(baseDir.getCanonicalPath())) { isAppBase = true; } @@ -655,7 +660,8 @@ } // Only remove directory and/or war if they are located in the // Host's appBase and autoDeploy or liveDeploy are true -if (isAppBase (host.getAutoDeploy() || host.getLiveDeploy())) { +if (isAppBase +(host.getAutoDeploy() || host.getLiveDeploy())) { String filename = contextFile.getName(); if (isWAR) { filename = filename.substring(0,filename.length()-4); @@ -669,7 +675,8 @@ deleteDir(contextFile); } if (host.isUnpackWARs()) { -File contextWAR = new File(context.getDocBase() + .war); +File contextWAR = +new File(context.getDocBase() + .war); if (contextWAR.exists()) { if (contextLastModified contextWAR.lastModified()) { @@ -681,8 +688,8 @@ contextFile.delete(); } } -if (host.isDeployXML()) { -File docBaseXml = new File(appBase,filename + .xml); +if (host.isDeployXML() (configFile != null)) { +File docBaseXml = new File(configFile); docBaseXml.delete(); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2003/06/15 00:42:51 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Address bug 20758. - Remove apparently useless reference. Revision ChangesPath 1.10 +2 -10 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- StandardHostDeployer.java 10 Jun 2003 20:03:42 - 1.9 +++ StandardHostDeployer.java 15 Jun 2003 07:42:51 - 1.10 @@ -123,13 +123,6 @@ /** - * The codeContext/code that was added via a call to - * codeaddChild()/code while parsing the configuration descriptor. - */ -private Context context = null; - - -/** * The codeContextRuleSet/code associated with our * codedigester/code instance. */ @@ -493,7 +486,6 @@ } // Install the new web application -this.context = null; this.overrideDocBase = docBase; InputStream stream = null; try { @@ -800,7 +792,7 @@ */ public void addChild(Container child) { -context = (Context) child; +Context context = (Context) child; String contextPath = context.getPath(); if (contextPath == null) throw new IllegalArgumentException - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
remm2003/06/10 13:03:42 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: - Small deployer refactorings, as discussed previsouly. - Don't remove WAR if newer than unpacked directory. - Generalize WAR unpacking, based on the unpackWAR flag. Revision ChangesPath 1.9 +25 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- StandardHostDeployer.java 25 Apr 2003 21:16:22 - 1.8 +++ StandardHostDeployer.java 10 Jun 2003 20:03:42 - 1.9 @@ -376,8 +376,14 @@ contextPath, war.toString())); String url = war.toString(); String docBase = null; +boolean isWAR = false; if (url.startsWith(jar:)) { url = url.substring(4, url.length() - 2); +if (!url.toLowerCase().endsWith(.war)) { +throw new IllegalArgumentException +(sm.getString(standardHost.warURL, url)); +} +isWAR = true; } if (url.startsWith(file://)) docBase = url.substring(7); @@ -387,6 +393,11 @@ throw new IllegalArgumentException (sm.getString(standardHost.warURL, url)); +// Expand war file if host wants wars unpacked +if (isWAR host.isUnpackWARs()) { +docBase = ExpandWar.expand(host, war, contextPath); +} + // Install the new web application try { Class clazz = Class.forName(host.getContextClass()); @@ -457,12 +468,14 @@ // Calculate the document base for the new web application (if needed) String docBase = null; // Optional override for value in config file +boolean isWAR = false; if (war != null) { String url = war.toString(); log.info(sm.getString(standardHost.installingWAR, url)); // Calculate the WAR file absolute pathname if (url.startsWith(jar:)) { url = url.substring(4, url.length() - 2); +isWAR = true; } if (url.startsWith(file://)) docBase = url.substring(7); @@ -474,6 +487,11 @@ } +// Expand war file if host wants wars unpacked +if (isWAR host.isUnpackWARs()) { +docBase = ExpandWar.expand(host, war); +} + // Install the new web application this.context = null; this.overrideDocBase = docBase; @@ -653,13 +671,18 @@ if (contextPath.length() == 0 filename.equals(ROOT) || filename.equals(contextPath.substring(1))) { if (!isWAR) { +long contextLastModified = +contextFile.lastModified(); if (contextFile.isDirectory()) { deleteDir(contextFile); } if (host.isUnpackWARs()) { File contextWAR = new File(context.getDocBase() + .war); if (contextWAR.exists()) { -contextWAR.delete(); +if (contextLastModified + contextWAR.lastModified()) { +contextWAR.delete(); +} } } } else { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
costin 2003/01/27 15:40:13 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: Changed to c-l. Set the class loader on digester - it seems the HEAD works better this way. Revision ChangesPath 1.6 +24 -26 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- StandardHostDeployer.java 15 Jan 2003 03:40:42 - 1.5 +++ StandardHostDeployer.java 27 Jan 2003 23:40:13 - 1.6 @@ -1,7 +1,4 @@ /* - * $Header$ - * $Revision$ - * $Date$ * * * @@ -99,6 +96,8 @@ public class StandardHostDeployer implements Deployer { +private static org.apache.commons.logging.Log log= +org.apache.commons.logging.LogFactory.getLog( StandardHostDeployer.class ); // --- Constructors @@ -128,6 +127,12 @@ /** + * The codeContextRuleSet/code associated with our + * codedigester/code instance. + */ +private ContextRuleSet contextRuleSet = null; + + /** * The codeDigester/code instance to use for deploying web applications * to this codeHost/code. strongWARNING/strong - Usage of this * instance must be appropriately synchronized to prevent simultaneous @@ -135,14 +140,6 @@ */ private Digester digester = null; - -/** - * The codeContextRuleSet/code associated with our - * codedigester/code instance. - */ -private ContextRuleSet contextRuleSet = null; - - /** * The codeStandardHost/code instance we are associated with. */ @@ -229,7 +226,7 @@ (sm.getString(standardHost.warRequired)); // Calculate the document base for the new web application -host.log(sm.getString(standardHost.installing, +log.info(sm.getString(standardHost.installing, contextPath, war.toString())); String url = war.toString(); String docBase = null; @@ -307,9 +304,10 @@ host.fireContainerEvent(PRE_INSTALL_EVENT, context); host.addChild(context); host.fireContainerEvent(INSTALL_EVENT, context); +} catch (ClassNotFoundException e) { +log.info(, e); } catch (Exception e) { -host.log(sm.getString(standardHost.installError, contextPath), - e); +log.info(Error installing, e); throw new IOException(e.toString()); } @@ -364,7 +362,7 @@ (sm.getString(standardHost.warRequired)); // Calculate the document base for the new web application -host.log(sm.getString(standardHost.installing, +log.info(sm.getString(standardHost.installing, contextPath, war.toString())); String url = war.toString(); String docBase = null; @@ -401,8 +399,8 @@ StandardServer server = (StandardServer) engine.getService().getServer(); server.storeContext(context); } catch (Exception e) { -host.log(sm.getString(standardHost.installError, contextPath), - e); +log.error(sm.getString(standardHost.installError, contextPath), + e); throw new IOException(e.toString()); } @@ -451,7 +449,7 @@ String docBase = null; // Optional override for value in config file if (war != null) { String url = war.toString(); -host.log(sm.getString(standardHost.installingWAR, url)); +log.info(sm.getString(standardHost.installingWAR, url)); // Calculate the WAR file absolute pathname if (url.startsWith(jar:)) { url = url.substring(4, url.length() - 2); @@ -474,6 +472,7 @@ stream = config.openStream(); Digester digester = createDigester(); digester.setDebug(host.getDebug()); +digester.setClassLoader(this.getClass().getClassLoader()); digester.clear(); digester.push(this); digester.parse(stream); @@ -559,12 +558,12 @@ (sm.getString(standardHost.pathMissing, contextPath)); // Remove this web application -host.log(sm.getString(standardHost.removing, contextPath)); +
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java StandardServer.java
amyroh 2002/08/20 16:09:18 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java StandardServer.java Log: Change install(String contextPath, URL war, String configFile) method to actually save context info to the configuration file you specify. Revision ChangesPath 1.4 +11 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- StandardHostDeployer.java 2 Aug 2002 01:37:43 - 1.3 +++ StandardHostDeployer.java 20 Aug 2002 23:09:18 - 1.4 @@ -75,10 +75,12 @@ import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Deployer; +import org.apache.catalina.Engine; import org.apache.catalina.Globals; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; +import org.apache.catalina.core.StandardServer; import org.apache.catalina.startup.ContextRuleSet; import org.apache.catalina.startup.NamingRuleSet; import org.apache.catalina.util.StringManager; @@ -344,6 +346,11 @@ host.fireContainerEvent(PRE_INSTALL_EVENT, context); host.addChild(context); host.fireContainerEvent(INSTALL_EVENT, context); + +// save context info into configFile +Engine engine = (Engine)host.getParent(); +StandardServer server = (StandardServer) engine.getService().getServer(); +server.storeContext(context); } catch (Exception e) { host.log(sm.getString(standardHost.installError, contextPath), e); 1.5 +61 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java Index: StandardServer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardServer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StandardServer.java 14 Aug 2002 19:36:17 - 1.4 +++ StandardServer.java 20 Aug 2002 23:09:18 - 1.5 @@ -803,6 +803,63 @@ } +/** + * Write the configuration information for codeContext/code + * out to the specified configuration file. + * + * @exception InstanceNotFoundException if the managed resource object + * cannot be found + * @exception MBeanException if the initializer of the object throws + * an exception, or persistence is not supported + * @exception RuntimeOperationsException if an exception is reported + * by the persistence mechanism + */ +public synchronized void storeContext(Context context) throws Exception { + +String configFile = context.getConfigFile(); + +if (configFile != null) { +File config = new File(configFile); +if (!config.isAbsolute()) { +config = new File(System.getProperty(catalina.base), +configFile); +} + +// Open an output writer for the new configuration file +PrintWriter writer = null; +try { +writer = new PrintWriter(new FileWriter(config)); +} catch (IOException e) { +if (writer != null) { +try { +writer.close(); +} catch (Throwable t) { +; +} +} +throw (e); +} + +writer.print(Context); +storeAttributes(writer, context); +writer.println(/Context); + +// Flush and close the output file +try { +writer.flush(); +} catch (Exception e) { +throw (e); +} +try { +writer.close(); +} catch (Exception e) { +throw (e); +} +} + +} + + // Private Methods -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardHostDeployer.java
amyroh 2002/07/31 18:40:49 Modified:catalina/src/share/org/apache/catalina/core StandardHostDeployer.java Log: Minor change that fixes a bug when an application is undeployed (removed), ContatinerEvent with the value of REMOVE_EVENT is fired. Submitted by Jeanfrancois Arcand. Revision ChangesPath 1.2 +5 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java Index: StandardHostDeployer.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StandardHostDeployer.java 18 Jul 2002 16:48:05 - 1.1 +++ StandardHostDeployer.java 1 Aug 2002 01:40:49 - 1.2 @@ -418,6 +418,7 @@ host.log(sm.getString(standardHost.removing, contextPath)); try { host.removeChild(context); +host.fireContainerEvent(REMOVE_EVENT, context); } catch (Exception e) { host.log(sm.getString(standardHost.removeError, contextPath), e); throw new IOException(e.toString()); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]