commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knezevic, Mihael" <m.kneze...@porta.de>
Subject RE: Commons/Net Documentation
Date Tue, 10 Jan 2006 07:24:04 GMT
http://jakarta.apache.org/commons/net/apidocs/index.html for the javadocs
 
> -----Original Message-----
> From: David Johnson [mailto:chachany@gmail.com] 
> Sent: Monday, January 09, 2006 10:54 PM
> To: Jakarta Commons Users List; chachany@gmail.com
> Subject: Re: Commons/Net Documentation
> 
> I've made some progress. I can now log into the server... but 
> instead of
> transferring the file 
> (C:\builds\wsdl\AmazonWebServices.wsdl), it creates a
> 0 length file with the name "C:\builds\wsdl\AmazonWebServices.wsdl"
> 
> hmmm wth am i missing?
> //Code:
> ftpServer.user(ftpUser);
> ftpServer.pass(ftpUser);
these 2 lines u don't need, cause from what i've seen in the code below u allready use the
login() method.

> ftpServer.cwd(directory); //testDirectory
u should use the changeWorkingDirectory() method

> ftpServer.stor(wsdlLocation); // wsdlLocation =
> "C:\builds\wsdl\AmazonWebServices.wsdl"
u could use the storeFile() method of the FTPClient or the storeFileStream() method

hope it helps.

mk

> 
> Thanks,
> Dave
> 
> On 1/9/06, David Johnson <chachany@gmail.com> wrote:
> >
> > Hi there
> >
> > I'm trying to find basic documentation for the Commons/Net 
> package, and
> > both links that I see here 
> http://jakarta.apache.org/commons/net/ are
> > rather unhelpful.
> >
> > What I'm trying to do is fairly straigtforward
> >
> > 1. Connect to a known FTP server
> > 2. Login to said FTP server using known userid and password
> > 3. set the transfer type to ASCII
> > 4. Transfer a file (whose location I have) to a 
> subdirectory (/uploadTest)
> >
> > 5. close the connection
> > 6. do allapproriate error checking.
> >
> > I dont see that sort of basic information in the JavaDocs..
> >
> > what I have so far is
> >
> > FTPClient ftpServer=new FTPClient();
> > FTPClientConfig conf = new 
> FTPClientConfig(FTPClientConfig.SYST_UNIX);
> > ftpServer.configure(conf);
> >
> > boolean error = false;
> > try {
> >     int reply;
> >
> >     ftpServer.connect(commonLocation);
> >     System.out.println("Connected to " + commonLocation + ".");
> >     System.out.print(ftpServer.getReplyString());
> >
> >     reply = ftpServer.getReplyCode();
> >
> >     if(!FTPReply.isPositiveCompletion(reply)) {
> >         ftpServer.disconnect();
> >         System.err.println("Error -- FTP server refused 
> connection.");
> >     }
> >
> >     ftpServer.login(ftpUser, ftpPass);
> >     // Set the transfer type
> >     // Chenge directories
> >     // transfer file
> >
> >     ftpServer.logout();
> > } catch(IOException e) {
> >     error = true;
> >     e.printStackTrace();
> > } finally {
> >     if(ftpServer.isConnected()) {
> >         try {
> >             ftpServer.disconnect();
> >         } catch(IOException ioe) {
> >             // do nothing
> >         }
> >     }
> > }
> >
> > where can I go to get this info?
> >
> > --
> > -Dave
> > ChaChaNY@Gmail.com
> 
> 
> 
> 
> --
> -Dave
> ChaChaNY@Gmail.com
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message