You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@locus.apache.org on 2000/11/15 17:40:34 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
bodewig 00/11/15 08:40:34
Modified: docs index.html
src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
Log:
Add a passive mode option to <ftp>
Submitted by: Stuart Roebuck <sr...@adolos.com>
Revision Changes Path
1.152 +19 -13 jakarta-ant/docs/index.html
Index: index.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/index.html,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -r1.151 -r1.152
--- index.html 2000/11/14 16:20:37 1.151
+++ index.html 2000/11/15 16:40:33 1.152
@@ -106,7 +106,7 @@
Once installed make sure the "jaxp.jar" and "parser.jar" files are in your classpath.
<p>
You will also need the JDK installed on your system, version 1.1 or later.
-
+ </p>
<hr>
<h2><a name="buildingant">Building Ant</a></h2>
<p>Go to the directory <code>jakarta-ant</code>.</p>
@@ -736,7 +736,7 @@
"**/.cvsignore"
</pre>
If you do not want these default excludes applied, you may disable them with the
-<code>defaultexcludes="no"</code> attribute.</p>
+<code>defaultexcludes="no"</code> attribute.
<h3><a name="patternset">PatternSets</a></h3>
<p>Patterns can be grouped to sets and later be referenced by their id
attribute. They are defined via a <code>patternset</code> element -
@@ -1890,7 +1890,7 @@
build.xml:4: No message
</pre>
-</p>
+
<pre> <fail message="Something wrong here."/></pre>
<p>will exit the current build and print something like the following to whereever
your output goes:
@@ -1899,7 +1899,7 @@
build.xml:4: Something wrong here.
</pre>
-</p>
+
<hr>
<h2><a name="filter">Filter</a></h2>
<h3>Description</h3>
@@ -2351,6 +2351,7 @@
If <code>create</code> (the default), the JAR is created anyway with only a manifest.
If <code>skip</code>, the JAR is not created and a warning is issued.
If <code>fail</code>, the JAR is not created and the build is halted with an error.
+</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -3384,7 +3385,7 @@
<hr>
<h2><a name="patch">Patch</a></h2>
<h3>Description</h3>
-<p>Applies a diff file to originals.
+<p>Applies a diff file to originals.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -3524,7 +3525,7 @@
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.</p>
<hr>
<h2><a name="rename">Rename</a></h2>
<h3><i>Deprecated</i></h3>
@@ -3945,7 +3946,7 @@
<p><pre>
<style basedir="doc" destdir="build/doc"
extension="html" style="style/apache.xml"/>
-</pre></p>
+</pre>
</blockquote>
<hr>
<h2><a name="tar">Tar</a></h2>
@@ -4413,7 +4414,7 @@
</pre>
using Ant's default manifest file. The content of
<code>WEB-INF/web.xml</code> is identical to
-<code>src/metadata/myapp.xml</code>.</p>
+<code>src/metadata/myapp.xml</code>.
<hr>
<h2><a name="zip">Zip</a></h2>
<h3>Description</h3>
@@ -4730,6 +4731,12 @@
<td valign="top" align="center">No</td>
</tr>
<tr>
+ <td valign="top">passive</td>
+ <td valign="top">selects passive-mode ("yes") transfers.
+ Defaults to "no"</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
<td valign="top">verbose</td>
<td valign="top">displays information on each file transferred if set
to "yes". Defaults to "no".</td>
@@ -4798,20 +4805,19 @@
<p>Logs in to <code>ftp.apache.org</code> at port <code>2121</code> as
<code>coder</code> with password <code>java1</code> and uploads all new or
changed HTML files in the <code>htdocs/manual</code> directory to the
-<code>/pub/incoming</code> directory. The files are transferred in text
-mode.</p>
+<code>/pub/incoming</code> directory. The files are transferred in text mode. Passive mode has been switched on to send files from behind a firewall.</p>
<pre> <ftp server="ftp.nt.org"
remotedir="c:\uploads"
userid="coder"
password="java1"
separator="\"
- verbose="yes"
+ verbose="yes"</pre>
+<PRE>
>
<fileset dir="htdocs/manual">
<include name="**/*.html" />
</fileset>
- </ftp></pre>
-<p>Logs in to the Windows-based <code>ftp.nt.org</code> as
+ </ftp></PRE><p>Logs in to the Windows-based <code>ftp.nt.org</code> as
<code>coder</code> with password <code>java1</code> and uploads all
HTML files in the <code>htdocs/manual</code> directory to the
<code>c:\uploads</code> directory. Progress messages are displayed as each
1.2 +23 -0 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Index: FTP.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FTP.java 2000/11/08 17:01:05 1.1
+++ FTP.java 2000/11/15 16:40:33 1.2
@@ -88,6 +88,7 @@
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;
@@ -251,6 +252,16 @@
}
/**
+ * 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.
*/
@@ -743,6 +754,18 @@
{
throw new BuildException(
"could not set transfer type: " +
+ 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());
}
}