Class Http4FileSystemConfigBuilder
java.lang.Object
org.apache.commons.vfs2.FileSystemConfigBuilder
org.apache.commons.vfs2.provider.http4.Http4FileSystemConfigBuilder
Configuration options builder utility for http4 provider.
- Since:
- 2.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Http4FileSystemConfigBuilderprivate static final StringDefines the connection timeout of an HTTP request.private static final DurationThe default value forCONNECTION_TIMEOUTconfiguration.private static final booleanThe default value forKEY_FOLLOW_REDIRECTconfiguration.private static final booleanThe default value forHOSTNAME_VERIFICATION_ENABLEDconfiguration.private static final booleanThe default value forKEEP_ALIVEconfiguration.private static final intThe default value forMAX_TOTAL_CONNECTIONSconfiguration.private static final intThe default value forMAX_HOST_CONNECTIONSconfiguration.private static final DurationThe default value forSO_TIMEOUTconfiguration.private static final StringThe default value forKEY_USER_AGENTconfiguration.private static final StringDefines whether the host name should be verified or not in SSL connections.private static final StringDefines whether Keep-Alive option is used or not.protected static final StringDefines whether the HttpClient should follow redirections from the responses.private static final StringDefines whether the preemptive authentication should be enabled or not.private static final StringDefines the User-Agent request header string of the underlying HttpClient.private static final StringDefines the keystore file path for SSL connections.private static final StringDefines the keystore pass phrase for SSL connections.private static final StringDefines the keystore type for the underlying HttpClient.private static final StringDefines the maximum number of connections allowed per host configuration.private static final StringDefines the maximum number of connections allowed overall.private static final StringDefines http scheme for proxy hostprivate static final StringDefines the socket timeout of an HTTP request. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprotectedHttp4FileSystemConfigBuilder(String prefix) Construct anHttp4FileSystemConfigBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends FileSystem> Gets the target of this configuration.intDeprecated./** Gets the connection timeout.org.apache.http.cookie.Cookie[]getCookies(FileSystemOptions opts) Gets the cookies to add to the request.booleanGets whether to follow redirects for the connection.static Http4FileSystemConfigBuilderGets the singleton builder.Return keystore file path to be used in SSL connections.(package private) StringReturn keystore pass phrase for SSL connections.Get keystore type for SSL connections.intGets the maximum number of connections allowed per host.intGets the maximum number of connections allowed.Gets the proxy authenticator where the system should get the credentials from.Gets the proxy to use for http connection.intGets the proxy-port to use for http the connection.Gets the proxy-scheme to use for http the connection.intDeprecated.Gets the socket timeout.Sets the charset used for url encoding.Gets the user agent stringbooleanDetermines if the hostname should be verified in SSL context.booleanisKeepAlive(FileSystemOptions opts) Determines if the FileSystemOptions indicate that HTTP Keep-Alive is respected.booleanDetermines if the FileSystemOptions indicate that preemptive authentication is requested.voidsetConnectionTimeout(FileSystemOptions opts, int connectionTimeout) Deprecated.voidsetConnectionTimeout(FileSystemOptions opts, Duration connectionTimeout) Sets the connection timeout.voidsetCookies(FileSystemOptions opts, org.apache.http.cookie.Cookie[] cookies) The cookies to add to the request.voidsetFollowRedirect(FileSystemOptions opts, boolean redirect) Sets whether to follow redirects for the connection.voidsetHostnameVerificationEnabled(FileSystemOptions opts, boolean hostnameVerificationEnabled) Sets if the hostname should be verified in SSL context.voidsetKeepAlive(FileSystemOptions opts, boolean keepAlive) Sets if the FileSystemOptions indicate that HTTP Keep-Alive is respected.voidsetKeyStoreFile(FileSystemOptions opts, String keyStoreFile) Set keystore file path for SSL connections.voidsetKeyStorePass(FileSystemOptions opts, String keyStorePass) Set keystore pass phrase for SSL connecdtions.voidsetKeyStoreType(FileSystemOptions opts, String keyStoreType) Set keystore type for SSL connections.voidsetMaxConnectionsPerHost(FileSystemOptions opts, int maxHostConnections) Sets the maximum number of connections allowed to any host.voidsetMaxTotalConnections(FileSystemOptions opts, int maxTotalConnections) Sets the maximum number of connections allowed.voidsetPreemptiveAuth(FileSystemOptions opts, boolean preemptiveAuth) Sets the given value for preemptive HTTP authentication (using BASIC) on the given FileSystemOptions object.voidsetProxyAuthenticator(FileSystemOptions opts, UserAuthenticator authenticator) Sets the proxy authenticator where the system should get the credentials from.voidsetProxyHost(FileSystemOptions opts, String proxyHost) Sets the proxy to use for http connection.voidsetProxyPort(FileSystemOptions opts, int proxyPort) Sets the proxy-port to use for http connection.voidsetProxyScheme(FileSystemOptions opts, String proxyScheme) Sets the proxy-scheme to use for http connection.voidsetSoTimeout(FileSystemOptions opts, int soTimeout) Deprecated.voidsetSoTimeout(FileSystemOptions opts, Duration soTimeout) Sets the socket timeout.voidsetUrlCharset(FileSystemOptions opts, String charset) Sets the charset used for URL encoding.voidsetUserAgent(FileSystemOptions opts, String userAgent) Sets the user agent to attach to the outgoing http methodsMethods inherited from class org.apache.commons.vfs2.FileSystemConfigBuilder
getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCharacter, getCharacter, getCharacter, getDouble, getDouble, getDouble, getDuration, getDuration, getDurationInteger, getDurationInteger, getEnum, getEnum, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setParam, setRootURI, toBooleanObject
-
Field Details
-
BUILDER
-
MAX_TOTAL_CONNECTIONS
Defines the maximum number of connections allowed overall. This value only applies to the number of connections from a particular instance of HTTP connection manager.This parameter expects a value of type
Integer.- See Also:
-
MAX_HOST_CONNECTIONS
Defines the maximum number of connections allowed per host configuration. These values only apply to the number of connections from a particular instance of HTTP connection manager.- See Also:
-
CONNECTION_TIMEOUT
Defines the connection timeout of an HTTP request.This parameter expects a value of type
Integer.- See Also:
-
SO_TIMEOUT
Defines the socket timeout of an HTTP request.This parameter expects a value of type
Integer.- See Also:
-
KEEP_ALIVE
Defines whether Keep-Alive option is used or not.This parameter expects a value of type
Boolean.- See Also:
-
KEYSTORE_FILE
Defines the keystore file path for SSL connections.This parameter expects a value of type
String.- See Also:
-
KEYSTORE_PASS
Defines the keystore pass phrase for SSL connections.This parameter expects a value of type
String.- See Also:
-
KEYSTORE_TYPE
Defines the keystore type for the underlying HttpClient.- See Also:
-
HOSTNAME_VERIFICATION_ENABLED
Defines whether the host name should be verified or not in SSL connections.This parameter expects a value of type
Boolean.- See Also:
-
KEY_FOLLOW_REDIRECT
Defines whether the HttpClient should follow redirections from the responses.This parameter expects a value of type
Boolean.- See Also:
-
KEY_USER_AGENT
Defines the User-Agent request header string of the underlying HttpClient.This parameter expects a value of type
String.- See Also:
-
KEY_PREEMPTIVE_AUTHENTICATION
Defines whether the preemptive authentication should be enabled or not.This parameter expects a value of type
Boolean.- See Also:
-
DEFAULT_MAX_CONNECTIONS
private static final int DEFAULT_MAX_CONNECTIONSThe default value forMAX_TOTAL_CONNECTIONSconfiguration.- See Also:
-
DEFAULT_MAX_HOST_CONNECTIONS
private static final int DEFAULT_MAX_HOST_CONNECTIONSThe default value forMAX_HOST_CONNECTIONSconfiguration.- See Also:
-
DEFAULT_CONNECTION_TIMEOUT
The default value forCONNECTION_TIMEOUTconfiguration. -
DEFAULT_SO_TIMEOUT
The default value forSO_TIMEOUTconfiguration. -
DEFAULT_KEEP_ALIVE
private static final boolean DEFAULT_KEEP_ALIVEThe default value forKEEP_ALIVEconfiguration.- See Also:
-
DEFAULT_FOLLOW_REDIRECT
private static final boolean DEFAULT_FOLLOW_REDIRECTThe default value forKEY_FOLLOW_REDIRECTconfiguration.- See Also:
-
DEFAULT_USER_AGENT
The default value forKEY_USER_AGENTconfiguration.- See Also:
-
DEFAULT_HOSTNAME_VERIFICATION_ENABLED
private static final boolean DEFAULT_HOSTNAME_VERIFICATION_ENABLEDThe default value forHOSTNAME_VERIFICATION_ENABLEDconfiguration.- See Also:
-
PROXY_SCHEME
Defines http scheme for proxy hostThis parameter expects a value of type
String.- See Also:
-
-
Constructor Details
-
Http4FileSystemConfigBuilder
private Http4FileSystemConfigBuilder() -
Http4FileSystemConfigBuilder
Construct anHttp4FileSystemConfigBuilder.- Parameters:
prefix- String for properties of this file system.
-
-
Method Details
-
getInstance
Gets the singleton builder.- Returns:
- the singleton builder.
-
getConfigClass
Description copied from class:FileSystemConfigBuilderGets the target of this configuration.- Specified by:
getConfigClassin classFileSystemConfigBuilder- Returns:
- the specific file system class
-
getConnectionTimeout
Deprecated.Gets the connection timeout.- Parameters:
opts- The FileSystem options.- Returns:
- The connection timeout.
-
getConnectionTimeoutDuration
/** Gets the connection timeout.- Parameters:
opts- The FileSystem options.- Returns:
- The connection timeout.
- Since:
- 2.8.0
-
getCookies
Gets the cookies to add to the request.- Parameters:
opts- The FileSystem options.- Returns:
- the Cookie array.
-
getFollowRedirect
Gets whether to follow redirects for the connection.- Parameters:
opts- The FileSystem options.- Returns:
trueto follow redirects,falsenot to.- See Also:
-
getKeyStoreFile
Return keystore file path to be used in SSL connections.- Parameters:
opts- the file system options to modify- Returns:
- keystore file path to be used in SSL connections
-
getKeyStorePass
Return keystore pass phrase for SSL connections.- Parameters:
opts- the file system options to modify- Returns:
- keystore pass phrase for SSL connections
-
getKeyStoreType
Get keystore type for SSL connections.- Parameters:
opts- the file system options to modify- Returns:
- keystore type for SSL connections
- Since:
- 2.7.0
-
getMaxConnectionsPerHost
Gets the maximum number of connections allowed per host.- Parameters:
opts- The FileSystemOptions.- Returns:
- The maximum number of connections allowed per host.
-
getMaxTotalConnections
Gets the maximum number of connections allowed.- Parameters:
opts- The FileSystemOptions.- Returns:
- The maximum number of connections allowed.
-
getProxyAuthenticator
Gets the proxy authenticator where the system should get the credentials from.- Parameters:
opts- The FileSystem options.- Returns:
- The UserAuthenticator.
-
getProxyHost
Gets the proxy to use for http connection. You have to set the ProxyPort too if you would like to have the proxy really used.- Parameters:
opts- The FileSystem options.- Returns:
- proxyHost
- See Also:
-
getProxyPort
Gets the proxy-port to use for http the connection. You have to set the ProxyHost too if you would like to have the proxy really used.- Parameters:
opts- The FileSystem options.- Returns:
- proxyPort: the port number or 0 if it is not set
- See Also:
-
getProxyScheme
Gets the proxy-scheme to use for http the connection. You have to set the ProxyHost too if you would like to have the proxy really used.- Parameters:
opts- The FileSystem options.- Returns:
- proxyScheme: the http/https scheme of proxy server
- Since:
- 2.7.0
- See Also:
-
getSoTimeout
Deprecated.Gets the socket timeout.- Parameters:
opts- The FileSystemOptions.- Returns:
- The socket timeout.
-
getSoTimeoutDuration
Gets the socket timeout.- Parameters:
opts- The FileSystemOptions.- Returns:
- The socket timeout.
- Since:
- 2.8.0
-
getUrlCharset
Sets the charset used for url encoding.- Parameters:
opts- The FileSystem options.- Returns:
- the charset name.
-
getUserAgent
Gets the user agent string- Parameters:
opts- the file system options to modify- Returns:
- User provided User-Agent string, otherwise default of: Commons-VFS
-
isHostnameVerificationEnabled
Determines if the hostname should be verified in SSL context.- Parameters:
opts- The FileSystemOptions.- Returns:
- true if if the FileSystemOptions indicate that HTTP Keep-Alive is respected.
-
isKeepAlive
Determines if the FileSystemOptions indicate that HTTP Keep-Alive is respected.- Parameters:
opts- The FileSystemOptions.- Returns:
- true if if the FileSystemOptions indicate that HTTP Keep-Alive is respected.
-
isPreemptiveAuth
Determines if the FileSystemOptions indicate that preemptive authentication is requested.- Parameters:
opts- The FileSystemOptions.- Returns:
- true if preemptiveAuth is requested.
-
setConnectionTimeout
Sets the connection timeout.- Parameters:
opts- The FileSystem options.connectionTimeout- The connection timeout.- Since:
- 2.8.0
-
setConnectionTimeout
Deprecated.Sets the connection timeout.- Parameters:
opts- The FileSystem options.connectionTimeout- The connection timeout.
-
setCookies
The cookies to add to the request.- Parameters:
opts- The FileSystem options.cookies- An array of Cookies.
-
setFollowRedirect
Sets whether to follow redirects for the connection.- Parameters:
opts- The FileSystem options.redirect-trueto follow redirects,falsenot to.- See Also:
-
setHostnameVerificationEnabled
public void setHostnameVerificationEnabled(FileSystemOptions opts, boolean hostnameVerificationEnabled) Sets if the hostname should be verified in SSL context.- Parameters:
opts- The FileSystemOptions.hostnameVerificationEnabled- whether hostname should be verified
-
setKeepAlive
Sets if the FileSystemOptions indicate that HTTP Keep-Alive is respected.- Parameters:
opts- The FileSystemOptions.keepAlive- whether the FileSystemOptions indicate that HTTP Keep-Alive is respected or not.
-
setKeyStoreFile
Set keystore file path for SSL connections.- Parameters:
opts- the file system options to modifykeyStoreFile- keystore file path
-
setKeyStorePass
Set keystore pass phrase for SSL connecdtions.- Parameters:
opts- the file system options to modifykeyStorePass- keystore pass phrase for SSL connecdtions
-
setKeyStoreType
Set keystore type for SSL connections.- Parameters:
opts- the file system options to modifykeyStoreType- keystore type for SSL connections- Since:
- 2.7.0
-
setMaxConnectionsPerHost
Sets the maximum number of connections allowed to any host.- Parameters:
opts- The FileSystem options.maxHostConnections- The maximum number of connections to a host.
-
setMaxTotalConnections
Sets the maximum number of connections allowed.- Parameters:
opts- The FileSystem options.maxTotalConnections- The maximum number of connections.
-
setPreemptiveAuth
Sets the given value for preemptive HTTP authentication (using BASIC) on the given FileSystemOptions object. Defaults to false if not set. It may be appropriate to set to true in cases when the resulting chattiness of the conversation outweighs any architectural desire to use a stronger authentication scheme than basic/preemptive.- Parameters:
opts- The FileSystemOptions.preemptiveAuth- the desired setting; true=enabled and false=disabled.
-
setProxyAuthenticator
Sets the proxy authenticator where the system should get the credentials from.- Parameters:
opts- The FileSystem options.authenticator- The UserAuthenticator.
-
setProxyHost
Sets the proxy to use for http connection.You have to set the ProxyPort too if you would like to have the proxy really used.
- Parameters:
opts- The FileSystem options.proxyHost- the host- See Also:
-
setProxyPort
Sets the proxy-port to use for http connection. You have to set the ProxyHost too if you would like to have the proxy really used.- Parameters:
opts- The FileSystem options.proxyPort- the port- See Also:
-
setProxyScheme
Sets the proxy-scheme to use for http connection. You have to set the ProxyHost too if you would like to have the proxy really used.- Parameters:
opts- The FileSystem options.proxyScheme- the protocol scheme- Since:
- 2.7.0
- See Also:
-
setSoTimeout
Sets the socket timeout.- Parameters:
opts- The FileSystem options.soTimeout- socket timeout.
-
setSoTimeout
Deprecated.Sets the socket timeout.- Parameters:
opts- The FileSystem options.soTimeout- socket timeout.
-
setUrlCharset
Sets the charset used for URL encoding.- Parameters:
opts- The FileSystem options.charset- the charset name.
-
setUserAgent
Sets the user agent to attach to the outgoing http methods- Parameters:
opts- the file system options to modifyuserAgent- User Agent String
-
getConnectionTimeoutDuration(FileSystemOptions).