[jboss-cvs] JBossAS SVN: r58271 - trunk/server/src/main/org/jboss/web/deployers

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 11 16:37:45 EST 2006


Author: scott.stark at jboss.org
Date: 2006-11-11 16:37:43 -0500 (Sat, 11 Nov 2006)
New Revision: 58271

Modified:
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
Log:
Better handling of jar url names and tmp war creation

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2006-11-11 21:09:55 UTC (rev 58270)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2006-11-11 21:37:43 UTC (rev 58271)
@@ -44,6 +44,7 @@
 import org.jboss.system.metadata.ServiceMetaData;
 import org.jboss.system.server.ServerConfig;
 import org.jboss.system.server.ServerConfigLocator;
+import org.jboss.util.file.Files;
 import org.jboss.util.file.JarUtils;
 import org.jboss.virtual.VirtualFile;
 import org.jboss.web.WebApplication;
@@ -295,7 +296,12 @@
                || warName.endsWith("!/") == true )
          {
             if( warName.startsWith("jar:") )
-               warName = warName.substring(4, warName.length()-2);
+            {
+               if( warName.endsWith("!/") )
+                  warName = warName.substring(4, warName.length()-2);
+               else
+                  warName = warName.substring(4, warName.length());
+            }
             URL warURL = new URL(warName);
             ServerConfig config = ServerConfigLocator.locate();
             String prefix = warURL.getFile();
@@ -305,7 +311,8 @@
             int dotWar = prefix.lastIndexOf(".war");
             if( dotWar > 0 )
                prefix = prefix.substring(0, dotWar);
-            File expWarFile = new File(config.getServerTempDeployDir(), prefix + "-exp.war");
+            File expWarFile = File.createTempFile(prefix, "-exp.war", config.getServerTempDeployDir());
+            expWarFile.delete();
             if( expWarFile.mkdir() == false )
                throw new DeploymentException("Was unable to mkdir: "+expWarFile);
             log.debug("Unpacking war to: "+expWarFile);
@@ -341,9 +348,13 @@
    {
       try
       {
-         String name = getObjectName(metaData);
-         ObjectName objectName = new ObjectName(name);
-         // TODO: ...
+         // Delete any expanded war
+         URL warURL = unit.getAttachment("org.jboss.web.expandedWarURL", URL.class);
+         if( warURL != null )
+         {
+            File war = new File(warURL.toURI());
+            Files.delete(war);
+         }
       }
       catch(Exception e)
       {




More information about the jboss-cvs-commits mailing list