Class HttpFileSystemConfigBuilder
java.lang.Object
org.apache.commons.vfs2.FileSystemConfigBuilder
org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder
Configuration options for HTTP.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
HttpFileSystemConfigBuilder
(String prefix) Create new config builder. -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<? extends FileSystem>
Get the target of this configuration.int
Retrieve the connection timeout.org.apache.commons.httpclient.Cookie[]
getCookies
(FileSystemOptions opts) The cookies to add to the request.boolean
Gets whether to follow redirects for the connection.static HttpFileSystemConfigBuilder
Gets the singleton builder.int
Retrieve the maximum number of connections allowed per host.int
Retrieve the maximum number of connections allowed.Get the proxy authenticator where the system should get the credentials from.Get the proxy to use for http connection.int
Get the proxy-port to use for http the connection.int
Retrieve the socket timeout.Set the charset used for url encoding.Return the user agent stringboolean
Determines if the FileSystemOptions indicate that preemptive authentication is requested.void
setConnectionTimeout
(FileSystemOptions opts, int connectionTimeout) The connection timeout.void
setCookies
(FileSystemOptions opts, org.apache.commons.httpclient.Cookie[] cookies) The cookies to add to the request.void
setFollowRedirect
(FileSystemOptions opts, boolean redirect) Sets whether to follow redirects for the connection.void
setMaxConnectionsPerHost
(FileSystemOptions opts, int maxHostConnections) The maximum number of connections allowed to any host.void
setMaxTotalConnections
(FileSystemOptions opts, int maxTotalConnections) The maximum number of connections allowed.void
setPreemptiveAuth
(FileSystemOptions opts, boolean preemptiveAuth) Sets the given value for preemptive HTTP authentication (using BASIC) on the given FileSystemOptions object.void
setProxyAuthenticator
(FileSystemOptions opts, UserAuthenticator authenticator) Set the proxy authenticator where the system should get the credentials from.void
setProxyHost
(FileSystemOptions opts, String proxyHost) Set the proxy to use for http connection.
You have to set the ProxyPort too if you would like to have the proxy really used.void
setProxyPort
(FileSystemOptions opts, int proxyPort) Set the proxy-port to use for http connection.void
setSoTimeout
(FileSystemOptions opts, int soTimeout) The socket timeout.void
setUrlCharset
(FileSystemOptions opts, String chaset) Set the charset used for url encoding.void
setUserAgent
(FileSystemOptions opts, String userAgent) Assign 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, getEnum, getEnum, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setParam, setRootURI
-
Field Details
-
KEY_FOLLOW_REDIRECT
- See Also:
-
KEY_USER_AGENT
- See Also:
-
-
Constructor Details
-
HttpFileSystemConfigBuilder
Create new config builder.- Parameters:
prefix
- String for properties of this file system.- Since:
- 2.0
-
-
Method Details
-
getInstance
Gets the singleton builder.- Returns:
- the singleton builder.
-
setUrlCharset
Set the charset used for url encoding.- Parameters:
opts
- The FileSystem options.chaset
- the chaset
-
getUrlCharset
Set the charset used for url encoding.- Parameters:
opts
- The FileSystem options.- Returns:
- the chaset
-
setProxyHost
Set 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
Set 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:
-
getProxyHost
Get 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
Get 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:
-
setProxyAuthenticator
Set the proxy authenticator where the system should get the credentials from.- Parameters:
opts
- The FileSystem options.authenticator
- The UserAuthenticator.
-
getProxyAuthenticator
Get the proxy authenticator where the system should get the credentials from.- Parameters:
opts
- The FileSystem options.- Returns:
- The UserAuthenticator.
-
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
-true
to follow redirects,false
not to.- Since:
- 2.1
- See Also:
-
getCookies
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:
true
to follow redirects,false
not to.- Since:
- 2.1
- See Also:
-
setMaxTotalConnections
The maximum number of connections allowed.- Parameters:
opts
- The FileSystem options.maxTotalConnections
- The maximum number of connections.- Since:
- 2.0
-
getMaxTotalConnections
Retrieve the maximum number of connections allowed.- Parameters:
opts
- The FileSystemOptions.- Returns:
- The maximum number of connections allowed.
- Since:
- 2.0
-
setMaxConnectionsPerHost
The maximum number of connections allowed to any host.- Parameters:
opts
- The FileSystem options.maxHostConnections
- The maximum number of connections to a host.- Since:
- 2.0
-
getMaxConnectionsPerHost
Retrieve the maximum number of connections allowed per host.- Parameters:
opts
- The FileSystemOptions.- Returns:
- The maximum number of connections allowed per host.
- Since:
- 2.0
-
isPreemptiveAuth
Determines if the FileSystemOptions indicate that preemptive authentication is requested.- Parameters:
opts
- The FileSystemOptions.- Returns:
- true if preemptiveAuth is requested.
- Since:
- 2.0
-
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.
-
setConnectionTimeout
The connection timeout.- Parameters:
opts
- The FileSystem options.connectionTimeout
- The connection timeout.- Since:
- 2.1
-
getConnectionTimeout
Retrieve the connection timeout.- Parameters:
opts
- The FileSystem options.- Returns:
- The connection timeout.
- Since:
- 2.1
-
setSoTimeout
The socket timeout.- Parameters:
opts
- The FileSystem options.soTimeout
- socket timeout.- Since:
- 2.1
-
getSoTimeout
Retrieve the socket timeout.- Parameters:
opts
- The FileSystemOptions.- Returns:
- The socket timeout.
- Since:
- 2.1
-
setUserAgent
Assign the user agent to attach to the outgoing http methods- Parameters:
userAgent
- User Agent String
-
getUserAgent
Return the user agent string- Returns:
- User provided User-Agent string, otherwise default of: Jakarta-Commons-VFS
-
getConfigClass
Description copied from class:FileSystemConfigBuilder
Get the target of this configuration.- Specified by:
getConfigClass
in classFileSystemConfigBuilder
- Returns:
- the specific file system class
-