tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager ManagerServlet.java
Date Wed, 06 Aug 2003 18:21:32 GMT
remm        2003/08/06 11:21:32

  Modified:    webapps/manager/WEB-INF/classes/org/apache/catalina/manager
                        ManagerServlet.java
  Log:
  - Create the appropriate dirs so that tagging works.
  - Generate the appropriate URLs so that deployment from a tagged WAR works.
  
  Revision  Changes    Path
  1.8       +27 -12    jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/ManagerServlet.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ManagerServlet.java	6 Aug 2003 17:50:21 -0000	1.7
  +++ ManagerServlet.java	6 Aug 2003 18:21:32 -0000	1.8
  @@ -592,6 +592,7 @@
           File deployedPath = deployed;
           if (tag != null) {
               deployedPath = new File(versioned, tag);
  +            deployedPath.mkdirs();
           }
   
           // Upload the web application archive to a local WAR file
  @@ -693,7 +694,6 @@
   
           // Find the local WAR file
           File localWar = new File(deployedPath, basename + ".war");
  -
           // Find the local context deployment file (if any)
           File localXml = new File(configBase, basename + ".xml");
   
  @@ -705,8 +705,7 @@
   
           // Copy WAR and XML to the host base
           if (tag != null) {
  -            deployedPath = deployed;
  -            File localWarCopy = new File(deployedPath, basename + ".war");
  +            File localWarCopy = new File(deployed, basename + ".war");
               copy(localWar, localWarCopy);
               try {
                   extractXml(localWar, localXml);
  @@ -719,13 +718,29 @@
               localWar = localWarCopy;
           }
   
  +        // Compute URLs
           String war = null;
  -        String config = null;
  -        if (localWar.exists()) {
  -            war = localWar.getAbsolutePath();
  +        try {
  +            URL url = localWar.toURL();
  +            war = url.toString();
  +            war = "jar:" + war + "!/";
  +        } catch(MalformedURLException e) {
  +            log("managerServlet.badUrl[" + displayPath + "]", e);
  +            writer.println(sm.getString("managerServlet.exception",
  +                                        e.toString()));
  +            return;
           }
  -        if (localXml.exists()) {
  -            config = localXml.getAbsolutePath();
  +        String config = null;
  +        try {
  +            if (localXml.exists()) {
  +                URL url = localXml.toURL();
  +                config = url.toString();
  +            }
  +        } catch (MalformedURLException e) {
  +            log("managerServlet.badUrl[" + displayPath + "]", e);
  +            writer.println(sm.getString("managerServlet.exception",
  +                                        e.toString()));
  +            return;
           }
   
           // Deploy webapp
  
  
  

Mime
View raw message