it.sauronsoftware.ftp4j.connectors
Class FTPProxyConnector

java.lang.Object
  extended by it.sauronsoftware.ftp4j.FTPConnector
      extended by it.sauronsoftware.ftp4j.connectors.FTPProxyConnector

public class FTPProxyConnector
extends FTPConnector

This one connects a remote host via a FTP proxy which supports the SITE or the OPEN proxy method. The connector's default value for the useSuggestedAddressForDataConnections flag is true.

Author:
Carlo Pelliccia

Field Summary
 int style
          The style used by the proxy.
static int STYLE_OPEN_COMMAND
          Requires the connection to the remote host through a OPEN command without proxy authentication.
static int STYLE_SITE_COMMAND
          Requires the connection to the remote host through a SITE command after proxy authentication.
 
Fields inherited from class it.sauronsoftware.ftp4j.FTPConnector
closeTimeout, connectionTimeout, readTimeout
 
Constructor Summary
FTPProxyConnector(java.lang.String proxyHost, int proxyPort)
          Builds the connector.
FTPProxyConnector(java.lang.String proxyHost, int proxyPort, java.lang.String proxyUser, java.lang.String proxyPass)
          Builds the connector.
 
Method Summary
 java.net.Socket connectForCommunicationChannel(java.lang.String host, int port)
          This methods returns an established connection to a remote host, suitable for a FTP communication channel.
 java.net.Socket connectForDataTransferChannel(java.lang.String host, int port)
          This methods returns an established connection to a remote host, suitable for a FTP data transfer channel.
 void setStyle(int style)
          Sets the style used by the proxy.
 
Methods inherited from class it.sauronsoftware.ftp4j.FTPConnector
abortConnectForCommunicationChannel, setCloseTimeout, setConnectionTimeout, setReadTimeout, setUseSuggestedAddressForDataConnections, tcpConnectForCommunicationChannel, tcpConnectForDataTransferChannel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_SITE_COMMAND

public static int STYLE_SITE_COMMAND
Requires the connection to the remote host through a SITE command after proxy authentication. Default one.


STYLE_OPEN_COMMAND

public static int STYLE_OPEN_COMMAND
Requires the connection to the remote host through a OPEN command without proxy authentication.


style

public int style
The style used by the proxy.

Constructor Detail

FTPProxyConnector

public FTPProxyConnector(java.lang.String proxyHost,
                         int proxyPort,
                         java.lang.String proxyUser,
                         java.lang.String proxyPass)
Builds the connector. Default value for the style is STYLE_SITE_COMMAND.

Parameters:
proxyHost - The proxy host name.
proxyPort - The proxy port.
proxyUser - The username for proxy authentication.
proxyPass - The password for proxy authentication.

FTPProxyConnector

public FTPProxyConnector(java.lang.String proxyHost,
                         int proxyPort)
Builds the connector. Default value for the style is STYLE_SITE_COMMAND.

Parameters:
proxyHost - The proxy host name.
proxyPort - The proxy port.
Method Detail

setStyle

public void setStyle(int style)
Sets the style used by the proxy. STYLE_SITE_COMMAND - Requires the connection to the remote host through a SITE command after proxy authentication. STYLE_OPEN_COMMAND - Requires the connection to the remote host through a OPEN command without proxy authentication. Default value for the style is STYLE_SITE_COMMAND.

Parameters:
style - The style.
See Also:
STYLE_SITE_COMMAND, STYLE_OPEN_COMMAND

connectForCommunicationChannel

public java.net.Socket connectForCommunicationChannel(java.lang.String host,
                                                      int port)
                                               throws java.io.IOException
Description copied from class: FTPConnector
This methods returns an established connection to a remote host, suitable for a FTP communication channel.

Specified by:
connectForCommunicationChannel in class FTPConnector
Parameters:
host - The remote host name or address.
port - The remote port.
Returns:
The connection with the remote host.
Throws:
java.io.IOException - If the connection cannot be established.

connectForDataTransferChannel

public java.net.Socket connectForDataTransferChannel(java.lang.String host,
                                                     int port)
                                              throws java.io.IOException
Description copied from class: FTPConnector
This methods returns an established connection to a remote host, suitable for a FTP data transfer channel.

Specified by:
connectForDataTransferChannel in class FTPConnector
Parameters:
host - The remote host name or address.
port - The remote port.
Returns:
The connection with the remote host.
Throws:
java.io.IOException - If the connection cannot be established.