org.apache.commons.vfs2.provider.http
Class HttpFileSystemConfigBuilder

java.lang.Object
  extended by org.apache.commons.vfs2.FileSystemConfigBuilder
      extended by org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder
Direct Known Subclasses:
WebdavFileSystemConfigBuilder

public class HttpFileSystemConfigBuilder
extends FileSystemConfigBuilder

Configuration options for HTTP.

Author:
Commons VFS team

Constructor Summary
protected HttpFileSystemConfigBuilder(java.lang.String prefix)
           
 
Method Summary
protected  java.lang.Class<? extends FileSystem> getConfigClass()
           
 Cookie[] getCookies(FileSystemOptions opts)
          The cookies to add to the request.
static HttpFileSystemConfigBuilder getInstance()
           
 int getMaxConnectionsPerHost(FileSystemOptions opts)
          Retrieve the maximum number of connections allowed per host.
 int getMaxTotalConnections(FileSystemOptions opts)
          Retrieve the maximum number of connections allowed.
 UserAuthenticator getProxyAuthenticator(FileSystemOptions opts)
          Get the proxy authenticator where the system should get the credentials from.
 java.lang.String getProxyHost(FileSystemOptions opts)
          Get the proxy to use for http connection.
 int getProxyPort(FileSystemOptions opts)
          Get the proxy-port to use for http the connection.
 java.lang.String getUrlCharset(FileSystemOptions opts)
          Set the charset used for url encoding.
 boolean isPreemptiveAuth(FileSystemOptions opts)
          Determines if the FileSystemOptions indicate that preemptive authentication is requested.
 void setCookies(FileSystemOptions opts, Cookie[] cookies)
          The cookies to add to the request.
 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, java.lang.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 setUrlCharset(FileSystemOptions opts, java.lang.String chaset)
          Set the charset used for url encoding.
 
Methods inherited from class org.apache.commons.vfs2.FileSystemConfigBuilder
getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCharacter, getCharacter, getCharacter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setRootURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpFileSystemConfigBuilder

protected HttpFileSystemConfigBuilder(java.lang.String prefix)
Since:
2.0
Method Detail

getInstance

public static HttpFileSystemConfigBuilder getInstance()

setUrlCharset

public void setUrlCharset(FileSystemOptions opts,
                          java.lang.String chaset)
Set the charset used for url encoding.

Parameters:
opts - The FileSystem options.
chaset - the chaset

getUrlCharset

public java.lang.String getUrlCharset(FileSystemOptions opts)
Set the charset used for url encoding.

Parameters:
opts - The FileSystem options.
Returns:
the chaset

setProxyHost

public void setProxyHost(FileSystemOptions opts,
                         java.lang.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.

Parameters:
opts - The FileSystem options.
proxyHost - the host
See Also:
setProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)

setProxyPort

public void setProxyPort(FileSystemOptions opts,
                         int proxyPort)
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:
setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)

getProxyHost

public java.lang.String getProxyHost(FileSystemOptions opts)
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:
setProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)

getProxyPort

public int getProxyPort(FileSystemOptions opts)
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:
setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)

setProxyAuthenticator

public void setProxyAuthenticator(FileSystemOptions opts,
                                  UserAuthenticator authenticator)
Set the proxy authenticator where the system should get the credentials from.

Parameters:
opts - The FileSystem options.
authenticator - The UserAuthenticator.

getProxyAuthenticator

public UserAuthenticator getProxyAuthenticator(FileSystemOptions opts)
Get the proxy authenticator where the system should get the credentials from.

Parameters:
opts - The FileSystem options.
Returns:
The UserAuthenticator.

setCookies

public void setCookies(FileSystemOptions opts,
                       Cookie[] cookies)
The cookies to add to the request.

Parameters:
opts - The FileSystem options.
cookies - An array of Cookies.

getCookies

public Cookie[] getCookies(FileSystemOptions opts)
The cookies to add to the request.

Parameters:
opts - The FileSystem options.
Returns:
the Cookie array.

setMaxTotalConnections

public void setMaxTotalConnections(FileSystemOptions opts,
                                   int maxTotalConnections)
The maximum number of connections allowed.

Parameters:
opts - The FileSystem options.
maxTotalConnections - The maximum number of connections.
Since:
2.0

getMaxTotalConnections

public int getMaxTotalConnections(FileSystemOptions opts)
Retrieve the maximum number of connections allowed.

Parameters:
opts - The FileSystemOptions.
Returns:
The maximum number of connections allowed.
Since:
2.0

setMaxConnectionsPerHost

public void setMaxConnectionsPerHost(FileSystemOptions opts,
                                     int maxHostConnections)
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

public int getMaxConnectionsPerHost(FileSystemOptions opts)
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

public boolean isPreemptiveAuth(FileSystemOptions opts)
Determines if the FileSystemOptions indicate that preemptive authentication is requested.

Parameters:
opts - The FileSystemOptions.
Returns:
true if preemptiveAuth is requested.
Since:
2.0

setPreemptiveAuth

public void setPreemptiveAuth(FileSystemOptions opts,
                              boolean preemptiveAuth)
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.

getConfigClass

protected java.lang.Class<? extends FileSystem> getConfigClass()
Specified by:
getConfigClass in class FileSystemConfigBuilder