Package org.apache.commons.net.ftp

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


        }

__main:
        try
        {
            if (!ftp.login(username, password))
            {
                ftp.logout();
                error = true;
                break __main;
            }
View Full Code Here


            }
            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

        int replyCode = client.getReplyCode();
        if (!FTPReply.isPositiveCompletion(replyCode)) {
            client.disconnect();
            throw new IOException(replyString);
        }
        if (!client.login(username, password)) {
            replyString = client.getReplyString();
            client.logout();
            throw new IOException(replyString);
        }
        client.setFileType(FTP.BINARY_FILE_TYPE);
View Full Code Here

        assertTrue(FileUtils.contentEquals(new File(from.getPath()), new File(response.getPath())));
        LOG.info("*****assert files done******");
        new File(prefix + "2.pdf").delete();
        FTPClient client = new FTPClient();
        client.connect(readConfig.getUrl());
        client.login(readConfig.getLogin(), readConfig.getPass());
        client.deleteFile("~/backup/1/1.pdf");
        client.disconnect();
        LOG.info("*****clean directories done******\n");
    }

View Full Code Here

    protected FTPClient getClient() throws IOException {
        FTPClient client = new FTPClient();
        log.debug("connect to host " + getHost());
        client.connect(getHost());
        log.debug("login using username " + getUsername());
        if (!client.login(getUsername(), getPassword())){
            throw new IOException("user is not login, code " + client.getReplyCode() + ", message: " + client.getReplyString());
        }
        return client;
    }
View Full Code Here

            }

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

            if ((task.getAccount() != null && !ftp.login(task.getUserid(), task.getPassword(), task.getAccount()))
                || (task.getAccount() == null && !ftp.login(task.getUserid(), task.getPassword()))) {
                throw new BuildException("Could not login to FTP server");
            }

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

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

            if ((task.getAccount() != null && !ftp.login(task.getUserid(), task.getPassword(), task.getAccount()))
                || (task.getAccount() == null && !ftp.login(task.getUserid(), task.getPassword()))) {
                throw new BuildException("Could not login to FTP server");
            }

            task.log("login succeeded", Project.MSG_VERBOSE);
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

        int code = ftp.getReplyCode();
        if (!FTPReply.isPositiveCompletion(code)) {
            ftp.disconnect();
            throw new ConnectionRefusedException(code);
        }
        if (!ftp.login(getUsername(), getPassword())) {
            ftp.disconnect();
            throw new ConnectionRefusedException(ftp.getReplyCode());
        }
        if (isBinaryMode()) {
            ftp.setFileType(FTP.BINARY_FILE_TYPE);
View Full Code Here

            // -----------
            // 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);
                    ftp.logout();
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.