Package org.apache.commons.net.ftp

# Class FTPHTTPClient

java.lang.Object
org.apache.commons.net.SocketClient
org.apache.commons.net.ftp.FTP
org.apache.commons.net.ftp.FTPClient
org.apache.commons.net.ftp.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

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.commons.net.ftp.FTPClient

  `FTPClient.HostnameResolver, FTPClient.NatServerResolverImpl`

- ## Field Summary

  ### Fields inherited from class org.apache.commons.net.ftp.FTPClient

  `ACTIVE_LOCAL_DATA_CONNECTION_MODE, ACTIVE_REMOTE_DATA_CONNECTION_MODE, FTP_IP_ADDRESS_FROM_PASV_RESPONSE, FTP_SYSTEM_TYPE, FTP_SYSTEM_TYPE_DEFAULT, PASSIVE_LOCAL_DATA_CONNECTION_MODE, PASSIVE_REMOTE_DATA_CONNECTION_MODE, SYSTEM_TYPE_PROPERTIES`

  ### Fields inherited from class org.apache.commons.net.ftp.FTP

  `_commandSupport_, _controlEncoding, _controlInput_, _controlOutput_, _newReplyString, _replyCode, _replyLines, _replyString, ASCII_FILE_TYPE, BINARY_FILE_TYPE, BLOCK_TRANSFER_MODE, CARRIAGE_CONTROL_TEXT_FORMAT, COMPRESSED_TRANSFER_MODE, DEFAULT_CONTROL_ENCODING, DEFAULT_DATA_PORT, DEFAULT_PORT, EBCDIC_FILE_TYPE, FILE_STRUCTURE, LOCAL_FILE_TYPE, NON_PRINT_TEXT_FORMAT, PAGE_STRUCTURE, RECORD_STRUCTURE, REPLY_CODE_LEN, STREAM_TRANSFER_MODE, strictMultilineParsing, TELNET_TEXT_FORMAT`

  ### Fields inherited from class org.apache.commons.net.SocketClient

  `_defaultPort_, _hostname_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL, remoteInetSocketAddress`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FTPHTTPClient(String proxyHost, int proxyPort)`
  Create an instance using the UTF-8 encoding, with no proxy credentials.
  `FTPHTTPClient(String proxyHost, int proxyPort, String proxyUser, String proxyPass)`
  Create an instance using the UTF-8 encoding
  `FTPHTTPClient(String proxyHost, int proxyPort, String proxyUser, String proxyPass, Charset encoding)`
  Create an instance with the specified encoding
  `FTPHTTPClient(String proxyHost, int proxyPort, Charset encoding)`
  Create an instance using the specified encoding, with no proxy credentials.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Socket`
  `_openDataConnection_(int command, String arg)`
  Deprecated.
  (3.3) Use `FTPClient._openDataConnection_(FTPCmd, String)` instead
  `protected Socket`
  `_openDataConnection_(String command, String arg)`
  Establishes a data connection with the FTP server, returning a Socket for the connection if successful.
  `void`
  `connect(String host, int port)`
  Opens a Socket connected to a remote host at the specified port and originating from the current host at a system assigned port.

  ### Methods inherited from class org.apache.commons.net.ftp.FTPClient

  `_connectAction_, _connectAction_, _openDataConnection_, _parseExtendedPassiveModeReply, _parsePassiveModeReply, _retrieveFile, _retrieveFileStream, _storeFile, _storeFileStream, abort, allocate, allocate, allocate, allocate, appendFile, appendFileStream, changeToParentDirectory, changeWorkingDirectory, completePendingCommand, configure, deleteFile, disconnect, doCommand, doCommandAsStrings, enterLocalActiveMode, enterLocalPassiveMode, enterRemoteActiveMode, enterRemotePassiveMode, features, featureValue, featureValues, getAutodetectUTF8, getBufferSize, getControlKeepAliveReplyTimeout, getControlKeepAliveReplyTimeoutDuration, getControlKeepAliveTimeout, getControlKeepAliveTimeoutDuration, getCopyStreamListener, getCslDebug, getDataConnectionMode, getDataTimeout, getListArguments, getListHiddenFiles, getModificationTime, getPassiveHost, getPassiveLocalIPAddress, getPassivePort, getReceiveDataSocketBufferSize, getRestartOffset, getSendDataSocketBufferSize, getSize, getStatus, getStatus, getSystemName, getSystemType, hasFeature, hasFeature, hasFeature, initiateListParsing, initiateListParsing, initiateListParsing, initiateMListParsing, initiateMListParsing, isIpAddressFromPasvResponse, isRemoteVerificationEnabled, isUseEPSVwithIPv4, listDirectories, listDirectories, listFiles, listFiles, listFiles, listHelp, listHelp, listNames, listNames, login, login, logout, makeDirectory, mdtmCalendar, mdtmFile, mdtmInstant, mlistDir, mlistDir, mlistDir, mlistFile, printWorkingDirectory, reinitialize, remoteAppend, remoteRetrieve, remoteStore, remoteStoreUnique, remoteStoreUnique, removeDirectory, rename, restart, retrieveFile, retrieveFileStream, sendNoOp, sendSiteCommand, setActiveExternalIPAddress, setActivePortRange, setAutodetectUTF8, setBufferSize, setControlKeepAliveReplyTimeout, setControlKeepAliveReplyTimeout, setControlKeepAliveTimeout, setControlKeepAliveTimeout, setCopyStreamListener, setDataTimeout, setDataTimeout, setFileStructure, setFileTransferMode, setFileType, setFileType, setIpAddressFromPasvResponse, setListHiddenFiles, setModificationTime, setParserFactory, setPassiveLocalIPAddress, setPassiveLocalIPAddress, setPassiveNatWorkaround, setPassiveNatWorkaroundStrategy, setReceieveDataSocketBufferSize, setRemoteVerificationEnabled, setReportActiveExternalIPAddress, setRestartOffset, setSendDataSocketBufferSize, setUseEPSVwithIPv4, storeFile, storeFileStream, storeUniqueFile, storeUniqueFile, storeUniqueFileStream, storeUniqueFileStream, structureMount`

  ### Methods inherited from class org.apache.commons.net.ftp.FTP

  `__getReplyNoReport, __noop, abor, acct, allo, allo, allo, allo, appe, cdup, cwd, dele, eprt, epsv, feat, getCommandSupport, getControlEncoding, getReply, getReplyCode, getReplyString, getReplyStrings, help, help, isStrictMultilineParsing, isStrictReplyParsing, list, list, mdtm, mfmt, mkd, mlsd, mlsd, mlst, mlst, mode, nlst, nlst, noop, pass, pasv, port, pwd, quit, rein, rest, retr, rmd, rnfr, rnto, sendCommand, sendCommand, sendCommand, sendCommand, sendCommand, sendCommand, setControlEncoding, setStrictMultilineParsing, setStrictReplyParsing, site, size, smnt, stat, stat, stor, stou, stou, stru, syst, type, type, user`

  ### Methods inherited from class org.apache.commons.net.SocketClient

  `addProtocolCommandListener, applySocketAttributes, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, fireReplyReceived, getCharset, getCharsetName, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemoteInetSocketAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setCharset, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.
    (3.3) Use `FTPClient._openDataConnection_(FTPCmd, String)` instead
    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.
      `UnknownHostException` - If the hostname cannot be resolved.