Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.quit()


        } catch(ConnectException e) {
          throw new JMSException("Problem connecting the FTP-server");
        }
       
        if(!ftp.login(ftpUser, ftpPass)) {
          ftp.quit();
            ftp.disconnect();
            throw new JMSException("Cant Authentificate to FTP-Server");
        }
        String path = url.getPath();
        String workingDir = path.substring(0, path.lastIndexOf("/"));
View Full Code Here


        String file = path.substring(path.lastIndexOf("/")+1);
       
        ftp.changeWorkingDirectory(workingDir);
        ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
        InputStream input = ftp.retrieveFileStream(file);
        ftp.quit();
        ftp.disconnect();
       
        return input;
    }
   
View Full Code Here

        if (!ftp.storeFile(filename, in)) {
            throw new JMSException("FTP store failed: " + ftp.getReplyString());
        }
        return new URL(url + filename);
      } finally {
        ftp.quit();
        ftp.disconnect();
      }
   
  }
View Full Code Here

        } catch(ConnectException e) {
            throw new JMSException("Problem connecting the FTP-server");
        }

        if(!ftp.login(ftpUser, ftpPass)) {
            ftp.quit();
            ftp.disconnect();
            throw new JMSException("Cant Authentificate to FTP-Server");
        }
        String path = url.getPath();
        String workingDir = path.substring(0, path.lastIndexOf("/"));
View Full Code Here

        InputStream input = new FilterInputStream(ftp.retrieveFileStream(file)) {

            public void close() throws IOException {
                in.close();
                ftp.quit();
                ftp.disconnect();
            }
        };

        return input;
View Full Code Here

          ftp.connect(connectUrl, port);
        } catch(ConnectException e) {
          throw new JMSException("Problem connecting the FTP-server");
        }
    if(!ftp.login(ftpUser, ftpPass)) {
      ftp.quit();
      ftp.disconnect();
      throw new JMSException("Cant Authentificate to FTP-Server");
    }
    String path = url.getPath();
        String workingDir = path.substring(0, path.lastIndexOf("/"));
View Full Code Here

        } else {
          url = this.url.toString();
        }
       
    ftp.storeFile(filename, in);
    ftp.quit();
    ftp.disconnect();
   
    return new URL(url + filename);
  }
 
View Full Code Here

    int port = url.getPort() < 1 ? 21 : url.getPort();
   
    FTPClient ftp = new FTPClient();
    ftp.connect(connectUrl, port);
    if(!ftp.login("activemq", "activemq")) {
      ftp.quit();
      ftp.disconnect();
      throw new JMSException("Cant Authentificate to FTP-Server");
    }
    ftp.changeWorkingDirectory("ftptest");
    ftp.deleteFile("testmessage");
View Full Code Here

      ftp.disconnect();
      throw new JMSException("Cant Authentificate to FTP-Server");
    }
    ftp.changeWorkingDirectory("ftptest");
    ftp.deleteFile("testmessage");
    ftp.quit();
    ftp.disconnect();
    }
 
  public void testFileUpload() throws Exception {
    File file = File.createTempFile("amq-data-file-", ".dat");
View Full Code Here

            ftp.connect(connectUrl, port);
        } catch(ConnectException e) {
            throw new JMSException("Problem connecting the FTP-server");
        }
        if(!ftp.login(ftpUser, ftpPass)) {
            ftp.quit();
            ftp.disconnect();
            throw new JMSException("Cant Authentificate to FTP-Server");
        }
        return ftp;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.