Author: pero Date: Sat Apr 1 01:53:44 2006 New Revision: 390630 URL: http://svn.apache.org/viewcvs?rev=390630&view=rev Log: Fix ROOT.war deployment
Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java Modified: tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java?rev=390630&r1=390629&r2=390630&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java (original) +++ tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java Sat Apr 1 01:53:44 2006 @@ -52,12 +52,16 @@ * * @author Filip Hanik * @author Peter Rossbach - * @version 1.1 + * @version $Revision$ */ public class FarmWarDeployer implements ClusterDeployer, FileChangeListener { /*--Static Variables----------------------------------------*/ public static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory .getLog(FarmWarDeployer.class); + /** + * The descriptive information about this implementation. + */ + private static final String info = "FarmWarDeployer/1.2"; /*--Instance Variables--------------------------------------*/ protected CatalinaCluster cluster = null; @@ -117,6 +121,17 @@ public FarmWarDeployer() { } + /** + * Return descriptive information about this deployer implementation and the + * corresponding version number, in the format + * <code><description>/<version></code>. + */ + public String getInfo() { + + return (info); + + } + /*--Logic---------------------------------------------------*/ public void start() throws Exception { if (started) @@ -416,9 +431,7 @@ try { File deployWar = new File(getDeployDir(), newWar.getName()); copy(newWar, deployWar); - String contextName = "/" - + deployWar.getName().substring(0, - deployWar.getName().lastIndexOf(".war")); + String contextName = getContextName(deployWar); if (log.isInfoEnabled()) log.info("Installing webapp[" + contextName + "] from " + deployWar.getAbsolutePath()); @@ -440,9 +453,7 @@ */ public void fileRemoved(File removeWar) { try { - String contextName = "/" - + removeWar.getName().substring(0, - removeWar.getName().lastIndexOf(".war")); + String contextName = getContextName(removeWar); if (log.isInfoEnabled()) log.info("Removing webapp[" + contextName + "]"); remove(contextName, true); @@ -451,6 +462,21 @@ } } + /** + * Create a context path from war + * @param war War filename + * @return '/filename' or if war name is ROOT.war context name is empty string '' + */ + + protected String getContextName(File war) { + String contextName = "/" + + war.getName().substring(0, + war.getName().lastIndexOf(".war")); + if("/ROOT".equals(contextName)) + contextName= "" ; + return contextName ; + } + /** * Given a context path, get the config file name. */ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]