Package org.apache.commons.net.ftp

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


            // -----------
            // Then log in
            // -----------
            try {
                if(!ftp.login(this.data.getAttribute(USER_ATTR), this.data
                    .getAttribute(PASSWORD_ATTR))) {
                    logger.logMessage(
                        "Could not log in, check your username and password settings.",
                        this,
                        MessageLogger.ERROR);
View Full Code Here


            }

            log("connected", Project.MSG_VERBOSE);
            log("logging in to FTP server", Project.MSG_VERBOSE);

            if ((this.account != null && !ftp.login(userid, password, account))
                || (this.account == null && !ftp.login(userid, password))) {
                throw new BuildException("Could not login to FTP server");
            }

            log("login succeeded", Project.MSG_VERBOSE);
View Full Code Here

            log("connected", Project.MSG_VERBOSE);
            log("logging in to FTP server", Project.MSG_VERBOSE);

            if ((this.account != null && !ftp.login(userid, password, account))
                || (this.account == null && !ftp.login(userid, password))) {
                throw new BuildException("Could not login to FTP server");
            }

            log("login succeeded", Project.MSG_VERBOSE);
View Full Code Here

       
        // let's generate some stats
        FTPClient client1 = new FTPClient();
        client1.connect("localhost", port);
       
        assertTrue(client1.login(ADMIN_USERNAME, ADMIN_PASSWORD));
        assertTrue(client1.makeDirectory("foo"));
        assertTrue(client1.makeDirectory("foo2"));
        assertTrue(client1.removeDirectory("foo2"));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
View Full Code Here

        client1.disconnect();

        FTPClient client2 = new FTPClient();
        client2.connect("localhost", port);

        assertTrue(client2.login(ANONYMOUS_USERNAME, ANONYMOUS_PASSWORD));
        // done setting up stats
       
        client.connect("localhost", port);
        client.login(ADMIN_USERNAME, ADMIN_PASSWORD);
View Full Code Here

      ftp.connect(getServer());
      res.latencyEnd();
      int reply = ftp.getReplyCode();
            if (FTPReply.isPositiveCompletion(reply))
            {
              if (ftp.login( getUsername(), getPassword())){
                  if (binaryTransfer) {
                      ftp.setFileType(FTP.BINARY_FILE_TYPE);
                  }
          ftp.enterLocalPassiveMode();// should probably come from the setup dialog
          boolean ftpOK=false;
View Full Code Here

            assertTrue(client1.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
            assertTrue(client2.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
            assertTrue(client3.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
           
            try{
                assertTrue(client4.login(TESTUSER1_USERNAME, TESTUSER_PASSWORD));
                assertEquals(421, client.getReplyCode());
                fail("Must throw FTPConnectionClosedException");
            } catch(FTPConnectionClosedException e) {
                // expected
            }
View Full Code Here

                {
                    throw new FileSystemException("vfs.provider.ftp/connect-rejected.error", hostname);
                }

                // Login
                if (!client.login(
                    UserAuthenticatorUtils.toString(username),
                    UserAuthenticatorUtils.toString(password)))
                {
                    throw new FileSystemException("vfs.provider.ftp/login.error",
                        new Object[]{hostname, UserAuthenticatorUtils.toString(username)}, null);
View Full Code Here

        int reply = client.getReplyCode();
        if (!FTPReply.isPositiveCompletion(reply))
        {
            throw new IllegalArgumentException("cant connect: " + reply);
        }
        if (!client.login(user, pass))
        {
            throw new IllegalArgumentException("login failed");
        }
        client.enterLocalPassiveMode();
View Full Code Here

        }
        if (!FTPReply.isPositiveCompletion(client.getReplyCode()))
        {
            throw new IOException("Ftp connect failed: " + client.getReplyCode());
        }
        if (!client.login(uri.getUser(), uri.getPassword()))
        {
            throw new IOException("Ftp login failed: " + client.getReplyCode());
        }
        if (!client.setFileType(FTP.BINARY_FILE_TYPE))
        {
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.