public class FTPSEnvironment extends FTPEnvironment
FileSystemProvider.newFileSystem(URI, Map)
and
FileSystemProvider.newFileSystem(Path, Map)
methods of FTPSFileSystemProvider
.FTPEnvironment.QueryParam, FTPEnvironment.QueryParams
Constructor and Description |
---|
FTPSEnvironment()
Creates a new FTPS environment.
|
FTPSEnvironment(Map<String,Object> map)
Creates a new FTPS environment.
|
Modifier and Type | Method and Description |
---|---|
static FTPSEnvironment |
copy(Map<String,?> env)
Copies a map to create a new
FTPSEnvironment 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(Duration timeout)
Stores how long to wait for control keep-alive message replies.
|
FTPSEnvironment |
withControlKeepAliveReplyTimeout(int timeout)
Deprecated.
Use
withControlKeepAliveReplyTimeout(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 |
withControlKeepAliveTimeout(long timeout)
Deprecated.
Use
withControlKeepAliveTimeout(Duration) instead. |
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(Duration timeout)
Stores the timeout to use when reading from data connections.
|
FTPSEnvironment |
withDataTimeout(int timeout)
Deprecated.
Use
withDataTimeout(Duration) instead. |
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 not
SO_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 socket
SO_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 socket
SO_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 not
SO_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.
|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, setDefault, size, toString, values
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public FTPSEnvironment withLocalAddress(InetAddress localAddr, int localPort)
FTPEnvironment
withLocalAddress
in class FTPEnvironment
localAddr
- The local address to use.localPort
- The local port to use.Socket.bind(SocketAddress)
,
InetSocketAddress(InetAddress, int)
public FTPSEnvironment withCredentials(String username, char[] password)
FTPEnvironment
withCredentials
in class FTPEnvironment
username
- The username to use.password
- The password to use.public FTPSEnvironment withCredentials(String username, char[] password, String account)
FTPEnvironment
withCredentials
in class FTPEnvironment
username
- The username to use.password
- The password to use.account
- The account to use.public FTPSEnvironment withSoTimeout(int timeout)
FTPEnvironment
withSoTimeout
in class FTPEnvironment
timeout
- The socket timeout in milliseconds.Socket.setSoTimeout(int)
public FTPSEnvironment withSendBufferSize(int size)
FTPEnvironment
withSendBufferSize
in class FTPEnvironment
size
- The size of the buffer in bytes.Socket.setSendBufferSize(int)
public FTPSEnvironment withReceiveBufferSize(int size)
FTPEnvironment
withReceiveBufferSize
in class FTPEnvironment
size
- The size of the buffer in bytes.Socket.setReceiveBufferSize(int)
public FTPSEnvironment withTcpNoDelay(boolean on)
FTPEnvironment
TCP_NODELAY
) should be enabled.withTcpNoDelay
in class FTPEnvironment
on
- true
if Nagle's algorithm should be enabled, or false
otherwise.Socket.setTcpNoDelay(boolean)
public FTPSEnvironment withKeepAlive(boolean keepAlive)
FTPEnvironment
SO_KEEPALIVE
should be enabled.withKeepAlive
in class FTPEnvironment
keepAlive
- true
if keep-alive should be enabled, or false
otherwise.Socket.setKeepAlive(boolean)
public FTPSEnvironment withSoLinger(boolean on, int linger)
FTPEnvironment
SO_LINGER
should be enabled, and if so, the linger time.withSoLinger
in class FTPEnvironment
on
- true
if SO_LINGER
should be enabled, or false
otherwise.linger
- The linger time in seconds, if on
is true
.Socket.setSoLinger(boolean, int)
public FTPSEnvironment withSocketFactory(SocketFactory factory)
FTPEnvironment
withSocketFactory
in class FTPEnvironment
factory
- The socket factory to use.public FTPSEnvironment withServerSocketFactory(ServerSocketFactory factory)
FTPEnvironment
withServerSocketFactory
in class FTPEnvironment
factory
- The server socket factory to use.public FTPSEnvironment withConnectTimeout(int timeout)
FTPEnvironment
withConnectTimeout
in class FTPEnvironment
timeout
- The connection timeout in milliseconds.Socket.connect(SocketAddress, int)
public FTPSEnvironment withProxy(Proxy proxy)
FTPEnvironment
withProxy
in class FTPEnvironment
proxy
- The proxy to use.public FTPSEnvironment withCharset(Charset charset)
FTPEnvironment
withCharset
in class FTPEnvironment
charset
- The charset to use.public FTPSEnvironment withControlEncoding(String encoding)
FTPEnvironment
withControlEncoding
in class FTPEnvironment
encoding
- The character encoding to use.public FTPSEnvironment withStrictMultilineParsing(boolean strictMultilineParsing)
withStrictMultilineParsing
in class FTPEnvironment
strictMultilineParsing
- true
to enable strict multiline parsing, or false
to disable it.@Deprecated public FTPSEnvironment withDataTimeout(int timeout)
withDataTimeout(Duration)
instead.withDataTimeout
in class FTPEnvironment
timeout
- The timeout in milliseconds that is used when opening data connection sockets.public FTPSEnvironment withDataTimeout(Duration timeout)
withDataTimeout
in class FTPEnvironment
timeout
- The timeout in milliseconds that is used when opening data connection sockets.public FTPSEnvironment withParserFactory(FTPFileEntryParserFactory parserFactory)
FTPEnvironment
withParserFactory
in class FTPEnvironment
parserFactory
- The factory object used to create FTPFileEntryParser
spublic FTPSEnvironment withIpAddressFromPasvResponse(boolean usingIpAddressFromPasvResponse)
FTPClient.FTP_IP_ADDRESS_FROM_PASV_RESPONSE
.withIpAddressFromPasvResponse
in class FTPEnvironment
usingIpAddressFromPasvResponse
- true
if the IP address from the server's response should be used,
or false
to ignore that IP address.public FTPSEnvironment withRemoteVerificationEnabled(boolean enabled)
FTPEnvironment
withRemoteVerificationEnabled
in class FTPEnvironment
enabled
- true
to enable verification, or false
to disable verification.public FTPSEnvironment withDefaultDirectory(String pathname)
FTPEnvironment
withDefaultDirectory
in class FTPEnvironment
pathname
- The default directory to use.public FTPSEnvironment withConnectionMode(ConnectionMode connectionMode)
FTPEnvironment
ConnectionMode.ACTIVE
.withConnectionMode
in class FTPEnvironment
connectionMode
- The connection mode to use.public FTPSEnvironment withActivePortRange(int minPort, int maxPort)
FTPEnvironment
withActivePortRange
in class FTPEnvironment
minPort
- The lowest available port (inclusive).maxPort
- The highest available port (inclusive).public FTPSEnvironment withActiveExternalIPAddress(String ipAddress)
FTPEnvironment
withActiveExternalIPAddress
in class FTPEnvironment
ipAddress
- The external IP address of this machine.public FTPSEnvironment withPassiveLocalIPAddress(String ipAddress)
FTPEnvironment
withPassiveLocalIPAddress
in class FTPEnvironment
ipAddress
- The local IP address of this machine.public FTPSEnvironment withReportActiveExternalIPAddress(String ipAddress)
FTPEnvironment
withReportActiveExternalIPAddress
in class FTPEnvironment
ipAddress
- The external IP address of this machine.public FTPSEnvironment withBufferSize(int bufferSize)
FTPEnvironment
withBufferSize
in class FTPEnvironment
bufferSize
- The buffer size to use.public FTPSEnvironment withSendDataSocketBufferSize(int bufferSizr)
FTPEnvironment
SO_SNDBUF
option.withSendDataSocketBufferSize
in class FTPEnvironment
bufferSizr
- The size of the buffer.public FTPSEnvironment withReceiveDataSocketBufferSize(int bufferSize)
FTPEnvironment
SO_RCVBUF
option.withReceiveDataSocketBufferSize
in class FTPEnvironment
bufferSize
- The size of the buffer.public FTPSEnvironment withClientConfig(FTPClientConfig clientConfig)
FTPEnvironment
withClientConfig
in class FTPEnvironment
clientConfig
- The client config to use.public FTPSEnvironment withUseEPSVwithIPv4(boolean selected)
FTPEnvironment
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.
withUseEPSVwithIPv4
in class FTPEnvironment
selected
- The flag to use.@Deprecated public FTPSEnvironment withControlKeepAliveTimeout(long timeout)
withControlKeepAliveTimeout(Duration)
instead.withControlKeepAliveTimeout
in class FTPEnvironment
timeout
- The keep-alive timeout to use, in milliseconds.public FTPSEnvironment withControlKeepAliveTimeout(Duration timeout)
withControlKeepAliveTimeout
in class FTPEnvironment
timeout
- The keep-alive timeout to use.@Deprecated public FTPSEnvironment withControlKeepAliveReplyTimeout(int timeout)
withControlKeepAliveReplyTimeout(Duration)
instead.withControlKeepAliveReplyTimeout
in class FTPEnvironment
timeout
- The keep-alive reply timeout to use, in milliseconds.public FTPSEnvironment withControlKeepAliveReplyTimeout(Duration timeout)
withControlKeepAliveReplyTimeout
in class FTPEnvironment
timeout
- The keep-alive reply timeout to use.public FTPSEnvironment withPassiveNatWorkaroundStrategy(FTPClient.HostnameResolver resolver)
FTPClient.NatServerResolverImpl
, i.e. site-local replies are replaced.withPassiveNatWorkaroundStrategy
in class FTPEnvironment
resolver
- The workaround strategy to replace internal IP's in passive mode, or null
to disable the workaround
(i.e. use PASV mode reply address.)public FTPSEnvironment withAutodetectEncoding(boolean autodetect)
FTPEnvironment
withAutodetectEncoding
in class FTPEnvironment
autodetect
- true
to enable automatic server encoding detection, or false
to disable it.public FTPSEnvironment withListHiddenFiles(boolean listHiddenFiles)
true
.
Note that if this flag is set to false
, the current directory will (most likely) not be returned when listing directories.
That means that StandardFTPFileStrategyFactory.UNIX
will not work correctly.
Ideally, only set this flag (to false
) if the FTP server does not support the -a
option for LIST
commands.
withListHiddenFiles
in class FTPEnvironment
listHiddenFiles
- true
to list hidden files, or false
to omit them.public FTPSEnvironment withPoolConfig(FTPPoolConfig poolConfig)
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.
withPoolConfig
in class FTPEnvironment
poolConfig
- The pool config to use.public FTPSEnvironment withFileSystemExceptionFactory(FileSystemExceptionFactory factory)
FTPEnvironment
withFileSystemExceptionFactory
in class FTPEnvironment
factory
- The file system exception factory to use.public FTPSEnvironment withFTPFileStrategyFactory(FTPFileStrategyFactory factory)
FTPEnvironment
StandardFTPFileStrategyFactory.AUTO_DETECT
.withFTPFileStrategyFactory
in class FTPEnvironment
factory
- The FTP file strategy factory to use.@FTPEnvironment.QueryParam(value="securityMode") public FTPSEnvironment withSecurityMode(SecurityMode securityMode)
SecurityMode.EXPLICIT
.securityMode
- The security mode to use.public FTPSEnvironment withSSLContext(SSLContext sslContext)
protocol
will be used instead.sslContext
- The SSL context to use.@FTPEnvironment.QueryParam(value="protocol") public FTPSEnvironment withProtocol(String protocol)
TLS
.
The protocol will be ignored if an SSLContext
is stored.protocol
- The protocol to use.@FTPEnvironment.QueryParam(value="authCommand") public FTPSEnvironment withAuthCommand(String command)
command
- The AUTH command to use.public FTPSEnvironment withKeyManager(KeyManager keyManager)
keyManager
- The key manager to use.SSLContext.init(KeyManager[], TrustManager[], SecureRandom)
public FTPSEnvironment withTrustManager(TrustManager trustManager)
trustManager
- The trust manager to use.SSLContext.init(KeyManager[], TrustManager[], SecureRandom)
public FTPSEnvironment withHostnameVerifier(HostnameVerifier hostnameVerifier)
client mode
connections.hostnameVerifier
- The hostname verifier to use.@FTPEnvironment.QueryParam(value="endpointCheckingEnabled") public FTPSEnvironment withEndpointCheckingEnabled(boolean enabled)
client mode
connections.enabled
- true
if endpoint identification should be enabled, or false
if it should be disabled.SSLSocket.setSSLParameters(SSLParameters)
,
SSLParameters.setEndpointIdentificationAlgorithm(String)
@FTPEnvironment.QueryParam(value="enabledSessionCreation") public FTPSEnvironment withEnabledSessionCreation(boolean established)
established
- The established socket flag.SSLSocket.setEnableSessionCreation(boolean)
@FTPEnvironment.QueryParam(value="needClientAuth") public FTPSEnvironment withNeedClientAuth(boolean needClientAuth)
needClientAuth
- The need client authentication flag.SSLSocket.setNeedClientAuth(boolean)
@FTPEnvironment.QueryParam(value="wantClientAuth") public FTPSEnvironment withWantClientAuth(boolean wantClientAuth)
wantClientAuth
- The want client authentication flag.SSLSocket.setWantClientAuth(boolean)
@FTPEnvironment.QueryParam(value="useClientMode") public FTPSEnvironment withUseClientMode(boolean useClientMode)
useClientMode
- The use client mode flag.SSLSocket.setUseClientMode(boolean)
@FTPEnvironment.QueryParam(value="enabledCipherSuites") public FTPSEnvironment withEnabledCipherSuites(String... cipherSuites)
cipherSuites
- The names of the cipher suites to use.SSLSocket.setEnabledCipherSuites(String[])
@FTPEnvironment.QueryParam(value="enabledProtocols") public FTPSEnvironment withEnabledProtocols(String... protocolVersions)
protocolVersions
- The protocol versions to use.SSLSocket.setEnabledProtocols(String[])
@FTPEnvironment.QueryParam(value="dataChannelProtectionLevel") public FTPSEnvironment withDataChannelProtectionLevel(DataChannelProtectionLevel dataChannelProtectionLevel)
dataChannelProtectionLevel
- The data channel protection level to use.SSLSocket.setUseClientMode(boolean)
public static FTPSEnvironment copy(Map<String,?> env)
FTPSEnvironment
instance.env
- The map to copy. It can be an FTPSEnvironment
instance, but does not have to be.FTPSEnvironment
instance that is a copy of the given map.public static void setDefault(FTPSEnvironment defaultEnvironment)
FTPFileSystemProvider.getPath(URI)
when a file system needs to be created, since no environment can be passed.
This way, certain settings like pool configuration
can still be applied.defaultEnvironment
- The default FTPS environment. Use null
to reset it to an empty environment.Copyright © 2016–2024. All rights reserved.