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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 4 13:18:17 EST 2009


Author: alesj
Date: 2009-02-04 13:18:17 -0500 (Wed, 04 Feb 2009)
New Revision: 83860

Modified:
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
Log:
Fix how we determine if we need an exploded copy.

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2009-02-04 17:27:51 UTC (rev 83859)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2009-02-04 18:18:17 UTC (rev 83860)
@@ -22,7 +22,6 @@
 package org.jboss.web.deployers;
 
 import java.io.File;
-import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
@@ -30,12 +29,10 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.bootstrap.spi.ServerConfig;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.spi.deployer.helpers.AttachmentLocator;
@@ -56,9 +53,8 @@
 import org.jboss.system.metadata.ServiceDependencyMetaData;
 import org.jboss.system.metadata.ServiceInjectionValueMetaData;
 import org.jboss.system.metadata.ServiceMetaData;
-import org.jboss.system.server.ServerConfigLocator;
 import org.jboss.util.file.Files;
-import org.jboss.util.file.JarUtils;
+import org.jboss.virtual.VFSUtils;
 import org.jboss.virtual.VirtualFile;
 import org.jboss.web.WebApplication;
 
@@ -83,6 +79,7 @@
  * @author  Christoph.Jung at infor.de
  * @author  Thomas.Diesler at arcor.de
  * @author  adrian at jboss.org
+ * @author  ales.justin at jboss.org
  * @version $Revision$
  */
 public abstract class AbstractWarDeployer extends AbstractSimpleRealDeployer<JBossWebMetaData>
@@ -349,46 +346,18 @@
          if (unit instanceof VFSDeploymentUnit)
          {
             VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
-            URL expWarUrl = vfsUnit.getRoot().toURL();
-            if (warName.endsWith("/") == false || warName.endsWith("!/") == true) // Hack for jar urls being exposed
+            VirtualFile root = vfsUnit.getRoot();
+            URL expWarUrl = root.toURL();
+            VirtualFile explode = VFSUtils.explode(root);
+            boolean exploded = (root != explode);
+            // file was not exploded yet
+            if (exploded)
             {
-               if (warName.startsWith("jar:"))
-               {
-                  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();
-               int lastSlash = prefix.lastIndexOf('/');
-               if (lastSlash > 0)
-                  prefix = prefix.substring(lastSlash + 1);
-               int dotWar = prefix.lastIndexOf(".war");
-               if (dotWar > 0)
-                  prefix = prefix.substring(0, dotWar);
+               // get the real exploded url
+               expWarUrl = VFSUtils.getRealURL(explode);
 
-               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);
-               VirtualFile root = vfsUnit.getRoot();
-               InputStream is = root.openStream();
-               try
-               {
-                  JarUtils.unjar(is, expWarFile);
-               }
-               finally
-               {
-                  is.close();
-               }
-               expWarUrl = expWarFile.toURL();
-
                // Map
-               VirtualFile warVF = vfsUnit.getRoot();
-               String warPathName = warVF.getPathName();
+               String warPathName = root.getPathName();
                if (warPathName.endsWith("/") == false)
                   warPathName += "/";
                List<VirtualFile> classpathVFs = vfsUnit.getClassPath();




More information about the jboss-cvs-commits mailing list