Class FTPSEnvironment
- java.lang.Object
-
- com.github.robtimus.filesystems.ftp.FTPEnvironment
-
- com.github.robtimus.filesystems.ftp.FTPSEnvironment
-
public class FTPSEnvironment extends FTPEnvironment
A utility class to set up environments that can be used in theFileSystemProvider.newFileSystem(URI, Map)
andFileSystemProvider.newFileSystem(Path, Map)
methods ofFTPSFileSystemProvider
.- Author:
- Rob Spoor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.github.robtimus.filesystems.ftp.FTPEnvironment
FTPEnvironment.QueryParam, FTPEnvironment.QueryParams
-
-
Constructor Summary
Constructors Constructor Description FTPSEnvironment()
Creates a new FTPS environment.FTPSEnvironment(Map<String,Object> map)
Creates a new FTPS environment.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static FTPSEnvironment
copy(Map<String,?> env)
Copies a map to create a newFTPSEnvironment
instance.static void
setDefault(FTPSEnvironment defaultEnvironment)
Sets the default FTPS environment.FTPSEnvironment
withActiveExternalIPAddress(String ipAddress)
Stores the external IP address in active mode.FTPSEnvironment
withActivePortRange(int minPort, int maxPort)
Stores the client side port range in active mode.FTPSEnvironment
withAuthCommand(String command)
Stores the AUTH command to use.FTPSEnvironment
withAutodetectEncoding(boolean autodetect)
Stores whether or not automatic server encoding detection should be enabled.FTPSEnvironment
withBufferSize(int bufferSize)
Stores the buffer size to use.FTPSEnvironment
withCharset(Charset charset)
Stores the charset to use.FTPSEnvironment
withClientConfig(FTPClientConfig clientConfig)
Stores the FTP client config to use.FTPSEnvironment
withConnectionMode(ConnectionMode connectionMode)
Stores the connection mode to use.FTPSEnvironment
withConnectTimeout(int timeout)
Stores the connection timeout to use.FTPSEnvironment
withControlEncoding(String encoding)
Stores the character encoding to be used by the FTP control connection.FTPSEnvironment
withControlKeepAliveReplyTimeout(int timeout)
Deprecated.UsewithControlKeepAliveReplyTimeout(Duration)
instead.FTPSEnvironment
withControlKeepAliveReplyTimeout(Duration timeout)
Stores how long to wait for control keep-alive message replies.FTPSEnvironment
withControlKeepAliveTimeout(long timeout)
Deprecated.UsewithControlKeepAliveTimeout(Duration)
instead.FTPSEnvironment
withControlKeepAliveTimeout(Duration timeout)
Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.FTPSEnvironment
withCredentials(String username, char[] password)
Stores the credentials to use.FTPSEnvironment
withCredentials(String username, char[] password, String account)
Stores the credentials to use.FTPSEnvironment
withDataChannelProtectionLevel(DataChannelProtectionLevel dataChannelProtectionLevel)
Stores the data channel protection level to use.FTPSEnvironment
withDataTimeout(int timeout)
Deprecated.UsewithDataTimeout(Duration)
instead.FTPSEnvironment
withDataTimeout(Duration timeout)
Stores the timeout to use when reading from data connections.FTPSEnvironment
withDefaultDirectory(String pathname)
Stores the default directory to use.FTPSEnvironment
withEnabledCipherSuites(String... cipherSuites)
Stores the names of the cipher suites which could be enabled for use on connections.FTPSEnvironment
withEnabledProtocols(String... protocolVersions)
Stores which particular protocol versions are enabled for use on connections.FTPSEnvironment
withEnabledSessionCreation(boolean established)
Stores whether or not new SSL sessions may be established by sockets.FTPSEnvironment
withEndpointCheckingEnabled(boolean enabled)
Stores whether or not endpoint identification using the HTTPS algorithm should be enabled.FTPSEnvironment
withFileSystemExceptionFactory(FileSystemExceptionFactory factory)
Stores the file system exception factory to use.FTPSEnvironment
withFTPFileStrategyFactory(FTPFileStrategyFactory factory)
Stores the FTP file strategy factory to use.FTPSEnvironment
withHostnameVerifier(HostnameVerifier hostnameVerifier)
Stores the hostname verifier to use.FTPSEnvironment
withIpAddressFromPasvResponse(boolean usingIpAddressFromPasvResponse)
Sets whether or not the IP address from the server's response should be used.FTPSEnvironment
withKeepAlive(boolean keepAlive)
Stores whether or notSO_KEEPALIVE
should be enabled.FTPSEnvironment
withKeyManager(KeyManager keyManager)
Stores the key manager to use.FTPSEnvironment
withListHiddenFiles(boolean listHiddenFiles)
Stores whether or not to list hidden files.FTPSEnvironment
withLocalAddress(InetAddress localAddr, int localPort)
Stores the local address to use.FTPSEnvironment
withNeedClientAuth(boolean needClientAuth)
Stores whether or not sockets will require client authentication.FTPSEnvironment
withParserFactory(FTPFileEntryParserFactory parserFactory)
Stores the factory used for parser creation.FTPSEnvironment
withPassiveLocalIPAddress(String ipAddress)
Stores the local IP address to use in passive mode.FTPSEnvironment
withPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver resolver)
Stores the workaround strategy to replace the PASV mode reply addresses.FTPSEnvironment
withPoolConfig(FTPPoolConfig poolConfig)
Stores the pool config to use.FTPSEnvironment
withProtocol(String protocol)
Stores the protocol to use.FTPSEnvironment
withProxy(Proxy proxy)
Stores the proxy to use.FTPSEnvironment
withReceiveBufferSize(int size)
Stores the socket receive buffer size to use.FTPSEnvironment
withReceiveDataSocketBufferSize(int bufferSize)
Stores the value to use for the data socketSO_RCVBUF
option.FTPSEnvironment
withRemoteVerificationEnabled(boolean enabled)
Stores whether or not verification that the remote host taking part of a data connection is the same as the host to which the control connection is attached should be enabled.FTPSEnvironment
withReportActiveExternalIPAddress(String ipAddress)
Stores the external IP address to report in EPRT/PORT commands in active mode.FTPSEnvironment
withSecurityMode(SecurityMode securityMode)
Stores the security mode to use.FTPSEnvironment
withSendBufferSize(int size)
Stores the socket send buffer size to use.FTPSEnvironment
withSendDataSocketBufferSize(int bufferSizr)
Stores the value to use for the data socketSO_SNDBUF
option.FTPSEnvironment
withServerSocketFactory(ServerSocketFactory factory)
Stores the server socket factory to use.FTPSEnvironment
withSocketFactory(SocketFactory factory)
Stores the socket factory to use.FTPSEnvironment
withSoLinger(boolean on, int linger)
Stores whether or notSO_LINGER
should be enabled, and if so, the linger time.FTPSEnvironment
withSoTimeout(int timeout)
Stores the socket timeout.FTPSEnvironment
withSSLContext(SSLContext sslContext)
Stores the SSL context to use.FTPSEnvironment
withStrictMultilineParsing(boolean strictMultilineParsing)
Stores whether or not strict multiline parsing should be enabled, as per RFC 959, section 4.2.FTPSEnvironment
withTcpNoDelay(boolean on)
Stores whether or not the Nagle's algorithm (TCP_NODELAY
) should be enabled.FTPSEnvironment
withTrustManager(TrustManager trustManager)
Stores the trust manager to use.FTPSEnvironment
withUseClientMode(boolean useClientMode)
Stores whether or not sockets are set to use client mode in their first handshake.FTPSEnvironment
withUseEPSVwithIPv4(boolean selected)
Stores whether or not to use EPSV with IPv4.FTPSEnvironment
withWantClientAuth(boolean wantClientAuth)
Stores whether or not sockets will request client authentication.-
Methods inherited from class com.github.robtimus.filesystems.ftp.FTPEnvironment
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, setDefault, size, toString, values
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
withLocalAddress
public FTPSEnvironment withLocalAddress(InetAddress localAddr, int localPort)
Description copied from class:FTPEnvironment
Stores the local address to use.- Overrides:
withLocalAddress
in classFTPEnvironment
- Parameters:
localAddr
- The local address to use.localPort
- The local port to use.- Returns:
- This object.
- See Also:
Socket.bind(SocketAddress)
,InetSocketAddress(InetAddress, int)
-
withCredentials
public FTPSEnvironment withCredentials(String username, char[] password)
Description copied from class:FTPEnvironment
Stores the credentials to use.- Overrides:
withCredentials
in classFTPEnvironment
- Parameters:
username
- The username to use.password
- The password to use.- Returns:
- This object.
-
withCredentials
public FTPSEnvironment withCredentials(String username, char[] password, String account)
Description copied from class:FTPEnvironment
Stores the credentials to use.- Overrides:
withCredentials
in classFTPEnvironment
- Parameters:
username
- The username to use.password
- The password to use.account
- The account to use.- Returns:
- This object.
-
withSoTimeout
public FTPSEnvironment withSoTimeout(int timeout)
Description copied from class:FTPEnvironment
Stores the socket timeout.- Overrides:
withSoTimeout
in classFTPEnvironment
- Parameters:
timeout
- The socket timeout in milliseconds.- Returns:
- This object.
- See Also:
Socket.setSoTimeout(int)
-
withSendBufferSize
public FTPSEnvironment withSendBufferSize(int size)
Description copied from class:FTPEnvironment
Stores the socket send buffer size to use.- Overrides:
withSendBufferSize
in classFTPEnvironment
- Parameters:
size
- The size of the buffer in bytes.- Returns:
- This object.
- See Also:
Socket.setSendBufferSize(int)
-
withReceiveBufferSize
public FTPSEnvironment withReceiveBufferSize(int size)
Description copied from class:FTPEnvironment
Stores the socket receive buffer size to use.- Overrides:
withReceiveBufferSize
in classFTPEnvironment
- Parameters:
size
- The size of the buffer in bytes.- Returns:
- This object.
- See Also:
Socket.setReceiveBufferSize(int)
-
withTcpNoDelay
public FTPSEnvironment withTcpNoDelay(boolean on)
Description copied from class:FTPEnvironment
Stores whether or not the Nagle's algorithm (TCP_NODELAY
) should be enabled.- Overrides:
withTcpNoDelay
in classFTPEnvironment
- Parameters:
on
-true
if Nagle's algorithm should be enabled, orfalse
otherwise.- Returns:
- This object.
- See Also:
Socket.setTcpNoDelay(boolean)
-
withKeepAlive
public FTPSEnvironment withKeepAlive(boolean keepAlive)
Description copied from class:FTPEnvironment
Stores whether or notSO_KEEPALIVE
should be enabled.- Overrides:
withKeepAlive
in classFTPEnvironment
- Parameters:
keepAlive
-true
if keep-alive should be enabled, orfalse
otherwise.- Returns:
- This object.
- See Also:
Socket.setKeepAlive(boolean)
-
withSoLinger
public FTPSEnvironment withSoLinger(boolean on, int linger)
Description copied from class:FTPEnvironment
Stores whether or notSO_LINGER
should be enabled, and if so, the linger time.- Overrides:
withSoLinger
in classFTPEnvironment
- Parameters:
on
-true
ifSO_LINGER
should be enabled, orfalse
otherwise.linger
- The linger time in seconds, ifon
istrue
.- Returns:
- This object.
- See Also:
Socket.setSoLinger(boolean, int)
-
withSocketFactory
public FTPSEnvironment withSocketFactory(SocketFactory factory)
Description copied from class:FTPEnvironment
Stores the socket factory to use.- Overrides:
withSocketFactory
in classFTPEnvironment
- Parameters:
factory
- The socket factory to use.- Returns:
- This object.
-
withServerSocketFactory
public FTPSEnvironment withServerSocketFactory(ServerSocketFactory factory)
Description copied from class:FTPEnvironment
Stores the server socket factory to use.- Overrides:
withServerSocketFactory
in classFTPEnvironment
- Parameters:
factory
- The server socket factory to use.- Returns:
- This object.
-
withConnectTimeout
public FTPSEnvironment withConnectTimeout(int timeout)
Description copied from class:FTPEnvironment
Stores the connection timeout to use.- Overrides:
withConnectTimeout
in classFTPEnvironment
- Parameters:
timeout
- The connection timeout in milliseconds.- Returns:
- This object.
- See Also:
Socket.connect(SocketAddress, int)
-
withProxy
public FTPSEnvironment withProxy(Proxy proxy)
Description copied from class:FTPEnvironment
Stores the proxy to use.- Overrides:
withProxy
in classFTPEnvironment
- Parameters:
proxy
- The proxy to use.- Returns:
- This object.
-
withCharset
public FTPSEnvironment withCharset(Charset charset)
Description copied from class:FTPEnvironment
Stores the charset to use.- Overrides:
withCharset
in classFTPEnvironment
- Parameters:
charset
- The charset to use.- Returns:
- This object.
-
withControlEncoding
public FTPSEnvironment withControlEncoding(String encoding)
Description copied from class:FTPEnvironment
Stores the character encoding to be used by the FTP control connection. Some FTP servers require that commands be issued in a non-ASCII encoding like UTF-8 so that filenames with multi-byte character representations (e.g, Big 8) can be specified.- Overrides:
withControlEncoding
in classFTPEnvironment
- Parameters:
encoding
- The character encoding to use.- Returns:
- This object.
-
withStrictMultilineParsing
public FTPSEnvironment withStrictMultilineParsing(boolean strictMultilineParsing)
Stores whether or not strict multiline parsing should be enabled, as per RFC 959, section 4.2.- Overrides:
withStrictMultilineParsing
in classFTPEnvironment
- Parameters:
strictMultilineParsing
-true
to enable strict multiline parsing, orfalse
to disable it.- Returns:
- This object.
- Since:
- 2.1
-
withDataTimeout
@Deprecated public FTPSEnvironment withDataTimeout(int timeout)
Deprecated.UsewithDataTimeout(Duration)
instead.Stores the timeout in milliseconds to use when reading from data connections.- Overrides:
withDataTimeout
in classFTPEnvironment
- Parameters:
timeout
- The timeout in milliseconds that is used when opening data connection sockets.- Returns:
- This object.
-
withDataTimeout
public FTPSEnvironment withDataTimeout(Duration timeout)
Stores the timeout to use when reading from data connections.- Overrides:
withDataTimeout
in classFTPEnvironment
- Parameters:
timeout
- The timeout in milliseconds that is used when opening data connection sockets.- Returns:
- This object.
- Since:
- 3.1
-
withParserFactory
public FTPSEnvironment withParserFactory(FTPFileEntryParserFactory parserFactory)
Description copied from class:FTPEnvironment
Stores the factory used for parser creation.- Overrides:
withParserFactory
in classFTPEnvironment
- Parameters:
parserFactory
- The factory object used to createFTPFileEntryParser
s- Returns:
- This object.
-
withIpAddressFromPasvResponse
public FTPSEnvironment withIpAddressFromPasvResponse(boolean usingIpAddressFromPasvResponse)
Sets whether or not the IP address from the server's response should be used. Before version 3.1 (and version 3.9.0 of Apache Commons Net), this has always been the case. Beginning with version 3.1, that IP address will be silently ignored, and replaced with the remote IP address of the control connection, unless this configuration option is given, which restores the old behavior. To enable this by default, use the system propertyFTPClient.FTP_IP_ADDRESS_FROM_PASV_RESPONSE
.- Overrides:
withIpAddressFromPasvResponse
in classFTPEnvironment
- Parameters:
usingIpAddressFromPasvResponse
-true
if the IP address from the server's response should be used, orfalse
to ignore that IP address.- Returns:
- This object.
- Since:
- 3.1
-
withRemoteVerificationEnabled
public FTPSEnvironment withRemoteVerificationEnabled(boolean enabled)
Description copied from class:FTPEnvironment
Stores whether or not verification that the remote host taking part of a data connection is the same as the host to which the control connection is attached should be enabled.- Overrides:
withRemoteVerificationEnabled
in classFTPEnvironment
- Parameters:
enabled
-true
to enable verification, orfalse
to disable verification.- Returns:
- This object.
-
withDefaultDirectory
public FTPSEnvironment withDefaultDirectory(String pathname)
Description copied from class:FTPEnvironment
Stores the default directory to use. If it exists, this will be the directory that relative paths are resolved to.- Overrides:
withDefaultDirectory
in classFTPEnvironment
- Parameters:
pathname
- The default directory to use.- Returns:
- This object.
-
withConnectionMode
public FTPSEnvironment withConnectionMode(ConnectionMode connectionMode)
Description copied from class:FTPEnvironment
Stores the connection mode to use. If the connection mode is not set, it will default toConnectionMode.ACTIVE
.- Overrides:
withConnectionMode
in classFTPEnvironment
- Parameters:
connectionMode
- The connection mode to use.- Returns:
- This object.
-
withActivePortRange
public FTPSEnvironment withActivePortRange(int minPort, int maxPort)
Description copied from class:FTPEnvironment
Stores the client side port range in active mode.- Overrides:
withActivePortRange
in classFTPEnvironment
- Parameters:
minPort
- The lowest available port (inclusive).maxPort
- The highest available port (inclusive).- Returns:
- This object.
-
withActiveExternalIPAddress
public FTPSEnvironment withActiveExternalIPAddress(String ipAddress)
Description copied from class:FTPEnvironment
Stores the external IP address in active mode. Useful when there are multiple network cards.- Overrides:
withActiveExternalIPAddress
in classFTPEnvironment
- Parameters:
ipAddress
- The external IP address of this machine.- Returns:
- This object.
-
withPassiveLocalIPAddress
public FTPSEnvironment withPassiveLocalIPAddress(String ipAddress)
Description copied from class:FTPEnvironment
Stores the local IP address to use in passive mode. Useful when there are multiple network cards.- Overrides:
withPassiveLocalIPAddress
in classFTPEnvironment
- Parameters:
ipAddress
- The local IP address of this machine.- Returns:
- This object.
-
withReportActiveExternalIPAddress
public FTPSEnvironment withReportActiveExternalIPAddress(String ipAddress)
Description copied from class:FTPEnvironment
Stores the external IP address to report in EPRT/PORT commands in active mode. Useful when there are multiple network cards.- Overrides:
withReportActiveExternalIPAddress
in classFTPEnvironment
- Parameters:
ipAddress
- The external IP address of this machine.- Returns:
- This object.
-
withBufferSize
public FTPSEnvironment withBufferSize(int bufferSize)
Description copied from class:FTPEnvironment
Stores the buffer size to use.- Overrides:
withBufferSize
in classFTPEnvironment
- Parameters:
bufferSize
- The buffer size to use.- Returns:
- This object.
-
withSendDataSocketBufferSize
public FTPSEnvironment withSendDataSocketBufferSize(int bufferSizr)
Description copied from class:FTPEnvironment
Stores the value to use for the data socketSO_SNDBUF
option.- Overrides:
withSendDataSocketBufferSize
in classFTPEnvironment
- Parameters:
bufferSizr
- The size of the buffer.- Returns:
- This object.
-
withReceiveDataSocketBufferSize
public FTPSEnvironment withReceiveDataSocketBufferSize(int bufferSize)
Description copied from class:FTPEnvironment
Stores the value to use for the data socketSO_RCVBUF
option.- Overrides:
withReceiveDataSocketBufferSize
in classFTPEnvironment
- Parameters:
bufferSize
- The size of the buffer.- Returns:
- This object.
-
withClientConfig
public FTPSEnvironment withClientConfig(FTPClientConfig clientConfig)
Description copied from class:FTPEnvironment
Stores the FTP client config to use.- Overrides:
withClientConfig
in classFTPEnvironment
- Parameters:
clientConfig
- The client config to use.- Returns:
- This object.
-
withUseEPSVwithIPv4
public FTPSEnvironment withUseEPSVwithIPv4(boolean selected)
Description copied from class:FTPEnvironment
Stores whether or not to use EPSV with IPv4. Might be worth enabling in some circumstances.For example, when using IPv4 with NAT it may work with some rare configurations. E.g. if FTP server has a static PASV address (external network) and the client is coming from another internal network. In that case the data connection after PASV command would fail, while EPSV would make the client succeed by taking just the port.
- Overrides:
withUseEPSVwithIPv4
in classFTPEnvironment
- Parameters:
selected
- The flag to use.- Returns:
- This object.
-
withControlKeepAliveTimeout
@Deprecated public FTPSEnvironment withControlKeepAliveTimeout(long timeout)
Deprecated.UsewithControlKeepAliveTimeout(Duration)
instead.Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.- Overrides:
withControlKeepAliveTimeout
in classFTPEnvironment
- Parameters:
timeout
- The keep-alive timeout to use, in milliseconds.- Returns:
- This object.
-
withControlKeepAliveTimeout
public FTPSEnvironment withControlKeepAliveTimeout(Duration timeout)
Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.- Overrides:
withControlKeepAliveTimeout
in classFTPEnvironment
- Parameters:
timeout
- The keep-alive timeout to use.- Returns:
- This object.
- Since:
- 3.1
-
withControlKeepAliveReplyTimeout
@Deprecated public FTPSEnvironment withControlKeepAliveReplyTimeout(int timeout)
Deprecated.UsewithControlKeepAliveReplyTimeout(Duration)
instead.Stores how long to wait for control keep-alive message replies.- Overrides:
withControlKeepAliveReplyTimeout
in classFTPEnvironment
- Parameters:
timeout
- The keep-alive reply timeout to use, in milliseconds.- Returns:
- This object.
-
withControlKeepAliveReplyTimeout
public FTPSEnvironment withControlKeepAliveReplyTimeout(Duration timeout)
Stores how long to wait for control keep-alive message replies.- Overrides:
withControlKeepAliveReplyTimeout
in classFTPEnvironment
- Parameters:
timeout
- The keep-alive reply timeout to use.- Returns:
- This object.
- Since:
- 3.1
-
withPassiveNatWorkaroundStrategy
public FTPSEnvironment withPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver resolver)
Stores the workaround strategy to replace the PASV mode reply addresses. This gets around the problem that some NAT boxes may change the reply. The default implementation isFTPClient.NatServerResolverImpl
, i.e. site-local replies are replaced.- Overrides:
withPassiveNatWorkaroundStrategy
in classFTPEnvironment
- Parameters:
resolver
- The workaround strategy to replace internal IP's in passive mode, ornull
to disable the workaround (i.e. use PASV mode reply address.)- Returns:
- This object.
- Since:
- 1.1
-
withAutodetectEncoding
public FTPSEnvironment withAutodetectEncoding(boolean autodetect)
Description copied from class:FTPEnvironment
Stores whether or not automatic server encoding detection should be enabled. Note that only UTF-8 is supported.- Overrides:
withAutodetectEncoding
in classFTPEnvironment
- Parameters:
autodetect
-true
to enable automatic server encoding detection, orfalse
to disable it.- Returns:
- This object.
-
withListHiddenFiles
public FTPSEnvironment withListHiddenFiles(boolean listHiddenFiles)
Stores whether or not to list hidden files. If this flag is not set, it will default totrue
.Note that if this flag is set to
false
, the current directory will (most likely) not be returned when listing directories. That means thatStandardFTPFileStrategyFactory.UNIX
will not work correctly.Ideally, only set this flag (to
false
) if the FTP server does not support the-a
option forLIST
commands.- Overrides:
withListHiddenFiles
in classFTPEnvironment
- Parameters:
listHiddenFiles
-true
to list hidden files, orfalse
to omit them.- Returns:
- This object.
- Since:
- 2.0
-
withPoolConfig
public FTPSEnvironment withPoolConfig(FTPPoolConfig poolConfig)
Stores the pool config to use.The maximum pool size influences the number of concurrent threads that can access an FTP file system.
If the maximum wait time is negative, FTP file systems wait indefinitely until a client connection is available. This is the default setting if no pool config is defined.- Overrides:
withPoolConfig
in classFTPEnvironment
- Parameters:
poolConfig
- The pool config to use.- Returns:
- This object.
- Since:
- 3.0
-
withFileSystemExceptionFactory
public FTPSEnvironment withFileSystemExceptionFactory(FileSystemExceptionFactory factory)
Description copied from class:FTPEnvironment
Stores the file system exception factory to use.- Overrides:
withFileSystemExceptionFactory
in classFTPEnvironment
- Parameters:
factory
- The file system exception factory to use.- Returns:
- This object.
-
withFTPFileStrategyFactory
public FTPSEnvironment withFTPFileStrategyFactory(FTPFileStrategyFactory factory)
Description copied from class:FTPEnvironment
Stores the FTP file strategy factory to use. If the FTP file strategy factory is not set, it will default toStandardFTPFileStrategyFactory.AUTO_DETECT
.- Overrides:
withFTPFileStrategyFactory
in classFTPEnvironment
- Parameters:
factory
- The FTP file strategy factory to use.- Returns:
- This object.
-
withSecurityMode
@QueryParam("securityMode") public FTPSEnvironment withSecurityMode(SecurityMode securityMode)
Stores the security mode to use. If the security mode is not set, it will default toSecurityMode.EXPLICIT
.- Parameters:
securityMode
- The security mode to use.- Returns:
- This object.
-
withSSLContext
public FTPSEnvironment withSSLContext(SSLContext sslContext)
Stores the SSL context to use. If the SSL context is not set, theprotocol
will be used instead.- Parameters:
sslContext
- The SSL context to use.- Returns:
- This object.
-
withProtocol
@QueryParam("protocol") public FTPSEnvironment withProtocol(String protocol)
Stores the protocol to use. If the protocol is not set, it will default toTLS
. The protocol will be ignored if anSSLContext
is stored.- Parameters:
protocol
- The protocol to use.- Returns:
- This object.
-
withAuthCommand
@QueryParam("authCommand") public FTPSEnvironment withAuthCommand(String command)
Stores the AUTH command to use.- Parameters:
command
- The AUTH command to use.- Returns:
- This object.
-
withKeyManager
public FTPSEnvironment withKeyManager(KeyManager keyManager)
Stores the key manager to use.- Parameters:
keyManager
- The key manager to use.- Returns:
- This object.
- See Also:
SSLContext.init(KeyManager[], TrustManager[], SecureRandom)
-
withTrustManager
public FTPSEnvironment withTrustManager(TrustManager trustManager)
Stores the trust manager to use.- Parameters:
trustManager
- The trust manager to use.- Returns:
- This object.
- See Also:
SSLContext.init(KeyManager[], TrustManager[], SecureRandom)
-
withHostnameVerifier
public FTPSEnvironment withHostnameVerifier(HostnameVerifier hostnameVerifier)
Stores the hostname verifier to use. The verifier is only used onclient mode
connections.- Parameters:
hostnameVerifier
- The hostname verifier to use.- Returns:
- This object.
-
withEndpointCheckingEnabled
@QueryParam("endpointCheckingEnabled") public FTPSEnvironment withEndpointCheckingEnabled(boolean enabled)
Stores whether or not endpoint identification using the HTTPS algorithm should be enabled. The default behaviour is for this to be disabled. This check is only performed onclient mode
connections.- Parameters:
enabled
-true
if endpoint identification should be enabled, orfalse
if it should be disabled.- Returns:
- This object.
- See Also:
SSLSocket.setSSLParameters(SSLParameters)
,SSLParameters.setEndpointIdentificationAlgorithm(String)
-
withEnabledSessionCreation
@QueryParam("enabledSessionCreation") public FTPSEnvironment withEnabledSessionCreation(boolean established)
Stores whether or not new SSL sessions may be established by sockets.- Parameters:
established
- The established socket flag.- Returns:
- This object.
- See Also:
SSLSocket.setEnableSessionCreation(boolean)
-
withNeedClientAuth
@QueryParam("needClientAuth") public FTPSEnvironment withNeedClientAuth(boolean needClientAuth)
Stores whether or not sockets will require client authentication.- Parameters:
needClientAuth
- The need client authentication flag.- Returns:
- This object.
- See Also:
SSLSocket.setNeedClientAuth(boolean)
-
withWantClientAuth
@QueryParam("wantClientAuth") public FTPSEnvironment withWantClientAuth(boolean wantClientAuth)
Stores whether or not sockets will request client authentication.- Parameters:
wantClientAuth
- The want client authentication flag.- Returns:
- This object.
- See Also:
SSLSocket.setWantClientAuth(boolean)
-
withUseClientMode
@QueryParam("useClientMode") public FTPSEnvironment withUseClientMode(boolean useClientMode)
Stores whether or not sockets are set to use client mode in their first handshake.- Parameters:
useClientMode
- The use client mode flag.- Returns:
- This object.
- See Also:
SSLSocket.setUseClientMode(boolean)
-
withEnabledCipherSuites
@QueryParam("enabledCipherSuites") public FTPSEnvironment withEnabledCipherSuites(String... cipherSuites)
Stores the names of the cipher suites which could be enabled for use on connections.- Parameters:
cipherSuites
- The names of the cipher suites to use.- Returns:
- This object.
- See Also:
SSLSocket.setEnabledCipherSuites(String[])
-
withEnabledProtocols
@QueryParam("enabledProtocols") public FTPSEnvironment withEnabledProtocols(String... protocolVersions)
Stores which particular protocol versions are enabled for use on connections.- Parameters:
protocolVersions
- The protocol versions to use.- Returns:
- This object.
- See Also:
SSLSocket.setEnabledProtocols(String[])
-
withDataChannelProtectionLevel
@QueryParam("dataChannelProtectionLevel") public FTPSEnvironment withDataChannelProtectionLevel(DataChannelProtectionLevel dataChannelProtectionLevel)
Stores the data channel protection level to use.- Parameters:
dataChannelProtectionLevel
- The data channel protection level to use.- Returns:
- This object.
- Since:
- 2.2
- See Also:
SSLSocket.setUseClientMode(boolean)
-
copy
public static FTPSEnvironment copy(Map<String,?> env)
Copies a map to create a newFTPSEnvironment
instance.- Parameters:
env
- The map to copy. It can be anFTPSEnvironment
instance, but does not have to be.- Returns:
- A new
FTPSEnvironment
instance that is a copy of the given map. - Since:
- 3.0
-
setDefault
public static void setDefault(FTPSEnvironment defaultEnvironment)
Sets the default FTPS environment. This is used inFTPFileSystemProvider.getPath(URI)
when a file system needs to be created, since no environment can be passed. This way, certain settings likepool configuration
can still be applied.- Parameters:
defaultEnvironment
- The default FTPS environment. Usenull
to reset it to an empty environment.- Since:
- 3.2
-
-