org.apache.commons.net.ftp.FTPHTTPClient Java Examples

The following examples show how to use org.apache.commons.net.ftp.FTPHTTPClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FtpClient.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private FTPClient createFtpClient(FtpConfiguration configuration) {
    FtpConfiguration.Security security = configuration.getSecurity();
    if (!security.isPresent()) {
        LOGGER.log(Level.FINE, "No encryption used");
        ProxyInfo proxyInfo = RemoteUtils.getHttpProxy(configuration.getHost());
        if (proxyInfo != null) {
            LOGGER.log(Level.FINE, "HTTP proxy will be used");
            return new FTPHTTPClient(proxyInfo.getHost(), proxyInfo.getPort(), proxyInfo.getUsername(), proxyInfo.getPassword());
        }
        // no proxy
        LOGGER.log(Level.FINE, "No proxy will be used");
        return new FTPClient();
    }
    Encryption encryption = security.getEncryption();
    LOGGER.log(Level.FINE, "Used encryption {0}", encryption.name());
    // can be debugged by setting -J-Djavax.net.debug=all
    return new FTPSClient(encryption.getProtocol(), encryption.isImplicit());
}