Class FTPHTTPClient

All Implemented Interfaces:
Configurable

public class FTPHTTPClient extends FTPClient
Experimental attempt at FTP client that tunnels over an HTTP proxy connection.
Since:
2.2
  • Constructor Details

    • FTPHTTPClient

      public FTPHTTPClient(String proxyHost, int proxyPort)
      Create an instance using the UTF-8 encoding, with no proxy credentials.
      Parameters:
      proxyHost - the hostname to use
      proxyPort - the port to use
    • FTPHTTPClient

      public FTPHTTPClient(String proxyHost, int proxyPort, Charset encoding)
      Create an instance using the specified encoding, with no proxy credentials.
      Parameters:
      proxyHost - the hostname to use
      proxyPort - the port to use
      encoding - the encoding to use
    • FTPHTTPClient

      public FTPHTTPClient(String proxyHost, int proxyPort, String proxyUser, String proxyPass)
      Create an instance using the UTF-8 encoding
      Parameters:
      proxyHost - the hostname to use
      proxyPort - the port to use
      proxyUser - the user name for the proxy
      proxyPass - the password for the proxy
    • FTPHTTPClient

      public FTPHTTPClient(String proxyHost, int proxyPort, String proxyUser, String proxyPass, Charset encoding)
      Create an instance with the specified encoding
      Parameters:
      proxyHost - the hostname to use
      proxyPort - the port to use
      proxyUser - the user name for the proxy
      proxyPass - the password for the proxy
      encoding - the encoding to use
  • Method Details

    • _openDataConnection_

      @Deprecated protected Socket _openDataConnection_(int command, String arg) throws IOException
      Deprecated.
      Establishes a data connection with the FTP server, returning a Socket for the connection if successful. If a restart offset has been set with FTPClient.setRestartOffset(long), a REST command is issued to the server with the offset as an argument before establishing the data connection. Active mode connections also cause a local PORT command to be issued.
      Overrides:
      _openDataConnection_ in class FTPClient
      Parameters:
      command - The int representation of the FTP command to send.
      arg - The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
      Returns:
      A Socket corresponding to the established data connection. Null is returned if an FTP protocol error is reported at any point during the establishment and initialization of the connection.
      Throws:
      IllegalStateException - if connection mode is not passive
      IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
    • _openDataConnection_

      protected Socket _openDataConnection_(String command, String arg) throws IOException
      Establishes a data connection with the FTP server, returning a Socket for the connection if successful. If a restart offset has been set with FTPClient.setRestartOffset(long), a REST command is issued to the server with the offset as an argument before establishing the data connection. Active mode connections also cause a local PORT command to be issued.
      Overrides:
      _openDataConnection_ in class FTPClient
      Parameters:
      command - The text representation of the FTP command to send.
      arg - The arguments to the FTP command. If this parameter is set to null, then the command is sent with no argument.
      Returns:
      A Socket corresponding to the established data connection. Null is returned if an FTP protocol error is reported at any point during the establishment and initialization of the connection.
      Throws:
      IllegalStateException - if connection mode is not passive
      IOException - If an I/O error occurs while either sending a command to the server or receiving a reply from the server.
      Since:
      3.1
    • connect

      public void connect(String host, int port) throws SocketException, IOException
      Description copied from class: SocketClient
      Opens a Socket connected to a remote host at the specified port and originating from the current host at a system assigned port. Before returning, _connectAction_() is called to perform connection initialization actions.
      Overrides:
      connect in class SocketClient
      Parameters:
      host - The name of the remote host.
      port - The port to connect to on the remote host.
      Throws:
      SocketException - If the socket timeout could not be set.
      IOException - If the socket could not be opened. In most cases you will only want to catch IOException since SocketException is derived from it.