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 FTPSEnvironmentcopy(Map<String,?> env)Copies a map to create a newFTPSEnvironmentinstance.static voidsetDefault(FTPSEnvironment defaultEnvironment)Sets the default FTPS environment.FTPSEnvironmentwithActiveExternalIPAddress(String ipAddress)Stores the external IP address in active mode.FTPSEnvironmentwithActivePortRange(int minPort, int maxPort)Stores the client side port range in active mode.FTPSEnvironmentwithAuthCommand(String command)Stores the AUTH command to use.FTPSEnvironmentwithAutodetectEncoding(boolean autodetect)Stores whether or not automatic server encoding detection should be enabled.FTPSEnvironmentwithBufferSize(int bufferSize)Stores the buffer size to use.FTPSEnvironmentwithCharset(Charset charset)Stores the charset to use.FTPSEnvironmentwithClientConfig(FTPClientConfig clientConfig)Stores the FTP client config to use.FTPSEnvironmentwithConnectionMode(ConnectionMode connectionMode)Stores the connection mode to use.FTPSEnvironmentwithConnectTimeout(int timeout)Stores the connection timeout to use.FTPSEnvironmentwithControlEncoding(String encoding)Stores the character encoding to be used by the FTP control connection.FTPSEnvironmentwithControlKeepAliveReplyTimeout(int timeout)Deprecated.UsewithControlKeepAliveReplyTimeout(Duration)instead.FTPSEnvironmentwithControlKeepAliveReplyTimeout(Duration timeout)Stores how long to wait for control keep-alive message replies.FTPSEnvironmentwithControlKeepAliveTimeout(long timeout)Deprecated.UsewithControlKeepAliveTimeout(Duration)instead.FTPSEnvironmentwithControlKeepAliveTimeout(Duration timeout)Stores the time to wait between sending control connection keep-alive messages when processing file upload or download.FTPSEnvironmentwithCredentials(String username, char[] password)Stores the credentials to use.FTPSEnvironmentwithCredentials(String username, char[] password, String account)Stores the credentials to use.FTPSEnvironmentwithDataChannelProtectionLevel(DataChannelProtectionLevel dataChannelProtectionLevel)Stores the data channel protection level to use.FTPSEnvironmentwithDataTimeout(int timeout)Deprecated.UsewithDataTimeout(Duration)instead.FTPSEnvironmentwithDataTimeout(Duration timeout)Stores the timeout to use when reading from data connections.FTPSEnvironmentwithDefaultDirectory(String pathname)Stores the default directory to use.FTPSEnvironmentwithEnabledCipherSuites(String... cipherSuites)Stores the names of the cipher suites which could be enabled for use on connections.FTPSEnvironmentwithEnabledProtocols(String... protocolVersions)Stores which particular protocol versions are enabled for use on connections.FTPSEnvironmentwithEnabledSessionCreation(boolean established)Stores whether or not new SSL sessions may be established by sockets.FTPSEnvironmentwithEndpointCheckingEnabled(boolean enabled)Stores whether or not endpoint identification using the HTTPS algorithm should be enabled.FTPSEnvironmentwithFileSystemExceptionFactory(FileSystemExceptionFactory factory)Stores the file system exception factory to use.FTPSEnvironmentwithFTPFileStrategyFactory(FTPFileStrategyFactory factory)Stores the FTP file strategy factory to use.FTPSEnvironmentwithHostnameVerifier(HostnameVerifier hostnameVerifier)Stores the hostname verifier to use.FTPSEnvironmentwithIpAddressFromPasvResponse(boolean usingIpAddressFromPasvResponse)Sets whether or not the IP address from the server's response should be used.FTPSEnvironmentwithKeepAlive(boolean keepAlive)Stores whether or notSO_KEEPALIVEshould be enabled.FTPSEnvironmentwithKeyManager(KeyManager keyManager)Stores the key manager to use.FTPSEnvironmentwithListHiddenFiles(boolean listHiddenFiles)Stores whether or not to list hidden files.FTPSEnvironmentwithLocalAddress(InetAddress localAddr, int localPort)Stores the local address to use.FTPSEnvironmentwithNeedClientAuth(boolean needClientAuth)Stores whether or not sockets will require client authentication.FTPSEnvironmentwithParserFactory(FTPFileEntryParserFactory parserFactory)Stores the factory used for parser creation.FTPSEnvironmentwithPassiveLocalIPAddress(String ipAddress)Stores the local IP address to use in passive mode.FTPSEnvironmentwithPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver resolver)Stores the workaround strategy to replace the PASV mode reply addresses.FTPSEnvironmentwithPoolConfig(FTPPoolConfig poolConfig)Stores the pool config to use.FTPSEnvironmentwithProtocol(String protocol)Stores the protocol to use.FTPSEnvironmentwithProxy(Proxy proxy)Stores the proxy to use.FTPSEnvironmentwithReceiveBufferSize(int size)Stores the socket receive buffer size to use.FTPSEnvironmentwithReceiveDataSocketBufferSize(int bufferSize)Stores the value to use for the data socketSO_RCVBUFoption.FTPSEnvironmentwithRemoteVerificationEnabled(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.FTPSEnvironmentwithReportActiveExternalIPAddress(String ipAddress)Stores the external IP address to report in EPRT/PORT commands in active mode.FTPSEnvironmentwithSecurityMode(SecurityMode securityMode)Stores the security mode to use.FTPSEnvironmentwithSendBufferSize(int size)Stores the socket send buffer size to use.FTPSEnvironmentwithSendDataSocketBufferSize(int bufferSizr)Stores the value to use for the data socketSO_SNDBUFoption.FTPSEnvironmentwithServerSocketFactory(ServerSocketFactory factory)Stores the server socket factory to use.FTPSEnvironmentwithSocketFactory(SocketFactory factory)Stores the socket factory to use.FTPSEnvironmentwithSoLinger(boolean on, int linger)Stores whether or notSO_LINGERshould be enabled, and if so, the linger time.FTPSEnvironmentwithSoTimeout(int timeout)Stores the socket timeout.FTPSEnvironmentwithSSLContext(SSLContext sslContext)Stores the SSL context to use.FTPSEnvironmentwithStrictMultilineParsing(boolean strictMultilineParsing)Stores whether or not strict multiline parsing should be enabled, as per RFC 959, section 4.2.FTPSEnvironmentwithTcpNoDelay(boolean on)Stores whether or not the Nagle's algorithm (TCP_NODELAY) should be enabled.FTPSEnvironmentwithTrustManager(TrustManager trustManager)Stores the trust manager to use.FTPSEnvironmentwithUseClientMode(boolean useClientMode)Stores whether or not sockets are set to use client mode in their first handshake.FTPSEnvironmentwithUseEPSVwithIPv4(boolean selected)Stores whether or not to use EPSV with IPv4.FTPSEnvironmentwithWantClientAuth(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:FTPEnvironmentStores the local address to use.- Overrides:
withLocalAddressin 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:FTPEnvironmentStores the credentials to use.- Overrides:
withCredentialsin 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:FTPEnvironmentStores the credentials to use.- Overrides:
withCredentialsin 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:FTPEnvironmentStores the socket timeout.- Overrides:
withSoTimeoutin 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:FTPEnvironmentStores the socket send buffer size to use.- Overrides:
withSendBufferSizein 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:FTPEnvironmentStores the socket receive buffer size to use.- Overrides:
withReceiveBufferSizein 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:FTPEnvironmentStores whether or not the Nagle's algorithm (TCP_NODELAY) should be enabled.- Overrides:
withTcpNoDelayin classFTPEnvironment- Parameters:
on-trueif Nagle's algorithm should be enabled, orfalseotherwise.- Returns:
- This object.
- See Also:
Socket.setTcpNoDelay(boolean)
-
withKeepAlive
public FTPSEnvironment withKeepAlive(boolean keepAlive)
Description copied from class:FTPEnvironmentStores whether or notSO_KEEPALIVEshould be enabled.- Overrides:
withKeepAlivein classFTPEnvironment- Parameters:
keepAlive-trueif keep-alive should be enabled, orfalseotherwise.- Returns:
- This object.
- See Also:
Socket.setKeepAlive(boolean)
-
withSoLinger
public FTPSEnvironment withSoLinger(boolean on, int linger)
Description copied from class:FTPEnvironmentStores whether or notSO_LINGERshould be enabled, and if so, the linger time.- Overrides:
withSoLingerin classFTPEnvironment- Parameters:
on-trueifSO_LINGERshould be enabled, orfalseotherwise.linger- The linger time in seconds, ifonistrue.- Returns:
- This object.
- See Also:
Socket.setSoLinger(boolean, int)
-
withSocketFactory
public FTPSEnvironment withSocketFactory(SocketFactory factory)
Description copied from class:FTPEnvironmentStores the socket factory to use.- Overrides:
withSocketFactoryin classFTPEnvironment- Parameters:
factory- The socket factory to use.- Returns:
- This object.
-
withServerSocketFactory
public FTPSEnvironment withServerSocketFactory(ServerSocketFactory factory)
Description copied from class:FTPEnvironmentStores the server socket factory to use.- Overrides:
withServerSocketFactoryin classFTPEnvironment- Parameters:
factory- The server socket factory to use.- Returns:
- This object.
-
withConnectTimeout
public FTPSEnvironment withConnectTimeout(int timeout)
Description copied from class:FTPEnvironmentStores the connection timeout to use.- Overrides:
withConnectTimeoutin 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:FTPEnvironmentStores the proxy to use.- Overrides:
withProxyin classFTPEnvironment- Parameters:
proxy- The proxy to use.- Returns:
- This object.
-
withCharset
public FTPSEnvironment withCharset(Charset charset)
Description copied from class:FTPEnvironmentStores the charset to use.- Overrides:
withCharsetin classFTPEnvironment- Parameters:
charset- The charset to use.- Returns:
- This object.
-
withControlEncoding
public FTPSEnvironment withControlEncoding(String encoding)
Description copied from class:FTPEnvironmentStores 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:
withControlEncodingin 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:
withStrictMultilineParsingin classFTPEnvironment- Parameters:
strictMultilineParsing-trueto enable strict multiline parsing, orfalseto 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:
withDataTimeoutin 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:
withDataTimeoutin 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:FTPEnvironmentStores the factory used for parser creation.- Overrides:
withParserFactoryin classFTPEnvironment- Parameters:
parserFactory- The factory object used to createFTPFileEntryParsers- 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:
withIpAddressFromPasvResponsein classFTPEnvironment- Parameters:
usingIpAddressFromPasvResponse-trueif the IP address from the server's response should be used, orfalseto ignore that IP address.- Returns:
- This object.
- Since:
- 3.1
-
withRemoteVerificationEnabled
public FTPSEnvironment withRemoteVerificationEnabled(boolean enabled)
Description copied from class:FTPEnvironmentStores 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:
withRemoteVerificationEnabledin classFTPEnvironment- Parameters:
enabled-trueto enable verification, orfalseto disable verification.- Returns:
- This object.
-
withDefaultDirectory
public FTPSEnvironment withDefaultDirectory(String pathname)
Description copied from class:FTPEnvironmentStores the default directory to use. If it exists, this will be the directory that relative paths are resolved to.- Overrides:
withDefaultDirectoryin classFTPEnvironment- Parameters:
pathname- The default directory to use.- Returns:
- This object.
-
withConnectionMode
public FTPSEnvironment withConnectionMode(ConnectionMode connectionMode)
Description copied from class:FTPEnvironmentStores the connection mode to use. If the connection mode is not set, it will default toConnectionMode.ACTIVE.- Overrides:
withConnectionModein classFTPEnvironment- Parameters:
connectionMode- The connection mode to use.- Returns:
- This object.
-
withActivePortRange
public FTPSEnvironment withActivePortRange(int minPort, int maxPort)
Description copied from class:FTPEnvironmentStores the client side port range in active mode.- Overrides:
withActivePortRangein 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:FTPEnvironmentStores the external IP address in active mode. Useful when there are multiple network cards.- Overrides:
withActiveExternalIPAddressin classFTPEnvironment- Parameters:
ipAddress- The external IP address of this machine.- Returns:
- This object.
-
withPassiveLocalIPAddress
public FTPSEnvironment withPassiveLocalIPAddress(String ipAddress)
Description copied from class:FTPEnvironmentStores the local IP address to use in passive mode. Useful when there are multiple network cards.- Overrides:
withPassiveLocalIPAddressin classFTPEnvironment- Parameters:
ipAddress- The local IP address of this machine.- Returns:
- This object.
-
withReportActiveExternalIPAddress
public FTPSEnvironment withReportActiveExternalIPAddress(String ipAddress)
Description copied from class:FTPEnvironmentStores the external IP address to report in EPRT/PORT commands in active mode. Useful when there are multiple network cards.- Overrides:
withReportActiveExternalIPAddressin classFTPEnvironment- Parameters:
ipAddress- The external IP address of this machine.- Returns:
- This object.
-
withBufferSize
public FTPSEnvironment withBufferSize(int bufferSize)
Description copied from class:FTPEnvironmentStores the buffer size to use.- Overrides:
withBufferSizein classFTPEnvironment- Parameters:
bufferSize- The buffer size to use.- Returns:
- This object.
-
withSendDataSocketBufferSize
public FTPSEnvironment withSendDataSocketBufferSize(int bufferSizr)
Description copied from class:FTPEnvironmentStores the value to use for the data socketSO_SNDBUFoption.- Overrides:
withSendDataSocketBufferSizein classFTPEnvironment- Parameters:
bufferSizr- The size of the buffer.- Returns:
- This object.
-
withReceiveDataSocketBufferSize
public FTPSEnvironment withReceiveDataSocketBufferSize(int bufferSize)
Description copied from class:FTPEnvironmentStores the value to use for the data socketSO_RCVBUFoption.- Overrides:
withReceiveDataSocketBufferSizein classFTPEnvironment- Parameters:
bufferSize- The size of the buffer.- Returns:
- This object.
-
withClientConfig
public FTPSEnvironment withClientConfig(FTPClientConfig clientConfig)
Description copied from class:FTPEnvironmentStores the FTP client config to use.- Overrides:
withClientConfigin classFTPEnvironment- Parameters:
clientConfig- The client config to use.- Returns:
- This object.
-
withUseEPSVwithIPv4
public FTPSEnvironment withUseEPSVwithIPv4(boolean selected)
Description copied from class:FTPEnvironmentStores 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:
withUseEPSVwithIPv4in 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:
withControlKeepAliveTimeoutin 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:
withControlKeepAliveTimeoutin 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:
withControlKeepAliveReplyTimeoutin 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:
withControlKeepAliveReplyTimeoutin 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:
withPassiveNatWorkaroundStrategyin classFTPEnvironment- Parameters:
resolver- The workaround strategy to replace internal IP's in passive mode, ornullto 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:FTPEnvironmentStores whether or not automatic server encoding detection should be enabled. Note that only UTF-8 is supported.- Overrides:
withAutodetectEncodingin classFTPEnvironment- Parameters:
autodetect-trueto enable automatic server encoding detection, orfalseto 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.UNIXwill not work correctly.Ideally, only set this flag (to
false) if the FTP server does not support the-aoption forLISTcommands.- Overrides:
withListHiddenFilesin classFTPEnvironment- Parameters:
listHiddenFiles-trueto list hidden files, orfalseto 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:
withPoolConfigin classFTPEnvironment- Parameters:
poolConfig- The pool config to use.- Returns:
- This object.
- Since:
- 3.0
-
withFileSystemExceptionFactory
public FTPSEnvironment withFileSystemExceptionFactory(FileSystemExceptionFactory factory)
Description copied from class:FTPEnvironmentStores the file system exception factory to use.- Overrides:
withFileSystemExceptionFactoryin classFTPEnvironment- Parameters:
factory- The file system exception factory to use.- Returns:
- This object.
-
withFTPFileStrategyFactory
public FTPSEnvironment withFTPFileStrategyFactory(FTPFileStrategyFactory factory)
Description copied from class:FTPEnvironmentStores the FTP file strategy factory to use. If the FTP file strategy factory is not set, it will default toStandardFTPFileStrategyFactory.AUTO_DETECT.- Overrides:
withFTPFileStrategyFactoryin 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, theprotocolwill 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 anSSLContextis 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 modeconnections.- 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 modeconnections.- Parameters:
enabled-trueif endpoint identification should be enabled, orfalseif 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 newFTPSEnvironmentinstance.- Parameters:
env- The map to copy. It can be anFTPSEnvironmentinstance, but does not have to be.- Returns:
- A new
FTPSEnvironmentinstance 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 configurationcan still be applied.- Parameters:
defaultEnvironment- The default FTPS environment. Usenullto reset it to an empty environment.- Since:
- 3.2
-
-