From b86a0a2830f81aa373a40ca7db51c5308f58550a Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Wed, 15 Nov 2000 16:40:33 +0000
Subject: [PATCH] Add a passive mode option to
Submitted by: Stuart Roebuck
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268189 13f79535-47bb-0310-9956-ffa450edef68
---
docs/index.html | 32 +++++++++++--------
.../tools/ant/taskdefs/optional/net/FTP.java | 23 +++++++++++++
2 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index 67aef88a5..7631914fc 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -106,7 +106,7 @@ build Ant from the source code.
Once installed make sure the "jaxp.jar" and "parser.jar" files are in your classpath.
You will also need the JDK installed on your system, version 1.1 or later.
-
+
Go to the directory jakarta-ant
.
@@ -736,7 +736,7 @@ They are:
"**/.cvsignore"
If you do not want these default excludes applied, you may disable them with the
-defaultexcludes="no"
attribute.
+defaultexcludes="no"
attribute.
Patterns can be grouped to sets and later be referenced by their id
attribute. They are defined via a patternset
element -
@@ -1890,7 +1890,7 @@ BUILD FAILED
build.xml:4: No message
-
+
<fail message="Something wrong here."/>
will exit the current build and print something like the following to whereever
your output goes:
@@ -1899,7 +1899,7 @@ BUILD FAILED
build.xml:4: Something wrong here.
-
+
Description
@@ -2351,6 +2351,7 @@ You should not include META-INF/MANIFEST.MF in your set of files.
If create
(the default), the JAR is created anyway with only a manifest.
If skip
, the JAR is not created and a warning is issued.
If fail
, the JAR is not created and the build is halted with an error.
+
Parameters
@@ -3384,7 +3385,7 @@ to move to the todir directory.
Description
-Applies a diff file to originals.
+
Applies a diff file to originals.
Parameters
@@ -3524,7 +3525,7 @@ builds using the following:
to be your home directory. This technique is more appropriate for Unix than
Windows since the notion of a home directory doesn't exist on Windows. On the
JVM that I tested, the home directory on Windows is "C:\". Different JVM
-implementations may use other values for the home directory on Windows.
+implementations may use other values for the home directory on Windows.
Deprecated
@@ -3945,7 +3946,7 @@ class path
<style basedir="doc" destdir="build/doc"
extension="html" style="style/apache.xml"/>
-
+
@@ -4413,7 +4414,7 @@ images/large/logo.gif
using Ant's default manifest file. The content of
WEB-INF/web.xml
is identical to
-src/metadata/myapp.xml
.
+src/metadata/myapp.xml
.
Description
@@ -4729,6 +4730,12 @@ write patterns.
Defaults to "yes"
No |
+
+ passive |
+ selects passive-mode ("yes") transfers.
+ Defaults to "no" |
+ No |
+
verbose |
displays information on each file transferred if set
@@ -4798,20 +4805,19 @@ for anonymous .
Logs in to ftp.apache.org at port 2121 as
coder with password java1 and uploads all new or
changed HTML files in the htdocs/manual directory to the
-/pub/incoming directory. The files are transferred in text
-mode.
+/pub/incoming directory. The files are transferred in text mode. Passive mode has been switched on to send files from behind a firewall.
<ftp server="ftp.nt.org"
remotedir="c:\uploads"
userid="coder"
password="java1"
separator="\"
- verbose="yes"
+ verbose="yes"
+
>
<fileset dir="htdocs/manual">
<include name="**/*.html" />
</fileset>
- </ftp>
-Logs in to the Windows-based ftp.nt.org as
+ </ftp> Logs in to the Windows-based ftp.nt.org as
coder with password java1 and uploads all
HTML files in the htdocs/manual directory to the
c:\uploads directory. Progress messages are displayed as each
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 1246f267a..4c6e39f39 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -88,6 +88,7 @@ public class FTP
private String password;
private File listing;
private boolean binary = true;
+ private boolean passive = false;
private boolean verbose = false;
private boolean newerOnly = false;
private int action = SEND_FILES;
@@ -250,6 +251,16 @@ public class FTP
this.binary = binary;
}
+ /**
+ * Specifies whether to use passive mode. Set to true if you
+ * are behind a firewall and cannot connect without it. Passive mode
+ * is disabled by default.
+ */
+ public void setPassive(boolean passive)
+ {
+ this.passive = passive;
+ }
+
/**
* Set to true to receive notification about each file as it is
* transferred.
@@ -746,6 +757,18 @@ public class FTP
ftp.getReplyString());
}
}
+
+ if (passive)
+ {
+ log("entering passive mode", Project.MSG_VERBOSE);
+ ftp.enterLocalPassiveMode();
+ if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()))
+ {
+ throw new BuildException(
+ "could not enter into passive mode: " +
+ ftp.getReplyString());
+ }
+ }
if (remotedir != null)
{
|