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/catalina/src/share/org/apache/catalina/ant DeployTask.java
Date Wed, 06 Aug 2003 17:47:46 GMT
remm        2003/08/06 10:47:46

  Modified:    catalina/src/share/org/apache/catalina/ant DeployTask.java
  Log:
  - Allow passing a regular path instead of a URL for the WAR to upload.
  - Actually pass the right URL string, including the "update" flag.
  
  Revision  Changes    Path
  1.3       +23 -13    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/DeployTask.java
  
  Index: DeployTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/DeployTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeployTask.java	15 Jun 2003 18:27:11 -0000	1.2
  +++ DeployTask.java	6 Aug 2003 17:47:46 -0000	1.3
  @@ -64,6 +64,7 @@
   
   
   import java.io.BufferedInputStream;
  +import java.io.FileInputStream;
   import java.io.IOException;
   import java.net.URL;
   import java.net.URLConnection;
  @@ -196,13 +197,23 @@
           String contentType = null;
           int contentLength = -1;
           if (war != null) {
  -            try {
  -                URL url = new URL(war);
  -                URLConnection conn = url.openConnection();
  -                contentLength = conn.getContentLength();
  -                stream = new BufferedInputStream(conn.getInputStream(), 1024);
  -            } catch (IOException e) {
  -                throw new BuildException(e);
  +            if (war.startsWith("file:")) {
  +                try {
  +                    URL url = new URL(war);
  +                    URLConnection conn = url.openConnection();
  +                    contentLength = conn.getContentLength();
  +                    stream = new BufferedInputStream
  +                        (conn.getInputStream(), 1024);
  +                } catch (IOException e) {
  +                    throw new BuildException(e);
  +                }
  +            } else {
  +                try {
  +                    stream = new BufferedInputStream
  +                        (new FileInputStream(war), 1024);
  +                } catch (IOException e) {
  +                    throw new BuildException(e);
  +                }
               }
               contentType = "application/octet-stream";
           }
  @@ -226,8 +237,7 @@
               sb.append(URLEncoder.encode(tag));
           }
   
  -        execute("/deploy?path=" + URLEncoder.encode(this.path), stream,
  -                contentType, contentLength);
  +        execute(sb.toString(), stream, contentType, contentLength);
   
       }
   
  
  
  

Mime
View raw message