Package org.apache.webdav.lib
Class WebdavSession
java.lang.Object
org.apache.webdav.lib.WebdavSession
- Direct Known Subclasses:
WebdavResource
This WebdavSession class is for the session management of WebDAV clients.
This class saves and restores the requested client.
Although this class is thread safe, it should only be accessed by one
concurrent thread, since the underlying protocol, HTTP, is not multiplexed.
If simultaneous operations are needed, it is recommended to create
additional threads, each having its own associated WebDAV client.
Clients that use persistent connections SHOULD limit the number of
simultaneous connections that they maintain to a given server. A
single-user client SHOULD NOT maintain more than 2 connections with
any server or proxy. A proxy SHOULD use up to 2*N connections to
another server or proxy, where N is the number of simultaneously
active users. These guidelines are intended to improve HTTP response
times and avoid congestion.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.commons.httpclient.HttpClientThe Http client instance.protected intDebug level.protected org.apache.commons.httpclient.CredentialsCredentials to use for authenticationprotected org.apache.commons.httpclient.CredentialsCredentials to use for an authenticating proxyprotected StringThe hostname to use for the proxy, if anyprotected intPort number to use for proxy, if any -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClose an session and delete the connection information.voidcloseSession(org.apache.commons.httpclient.HttpClient client) Deprecated.Replaced by closeSession()org.apache.commons.httpclient.HttpClientgetSessionInstance(org.apache.commons.httpclient.HttpURL httpURL) Get aHttpClientinstance.org.apache.commons.httpclient.HttpClientgetSessionInstance(org.apache.commons.httpclient.HttpURL httpURL, boolean reset) Get aHttpClientinstance.voidsetCredentials(org.apache.commons.httpclient.Credentials credentials) Set credentials for authentication.voidsetDebug(int debug) Set debug level.voidSet proxy info, to use proxying.voidsetProxyCredentials(org.apache.commons.httpclient.Credentials credentials) Set credentials for authenticating against a proxy.
-
Field Details
-
client
protected org.apache.commons.httpclient.HttpClient clientThe Http client instance. -
hostCredentials
protected org.apache.commons.httpclient.Credentials hostCredentialsCredentials to use for authentication -
proxyHost
The hostname to use for the proxy, if any -
proxyPort
protected int proxyPortPort number to use for proxy, if any -
proxyCredentials
protected org.apache.commons.httpclient.Credentials proxyCredentialsCredentials to use for an authenticating proxy -
debug
protected int debugDebug level.
-
-
Constructor Details
-
WebdavSession
public WebdavSession()Default constructor.
-
-
Method Details
-
setDebug
public void setDebug(int debug) Set debug level. -
getSessionInstance
public org.apache.commons.httpclient.HttpClient getSessionInstance(org.apache.commons.httpclient.HttpURL httpURL) throws IOException Get aHttpClientinstance. This method returns a new client instance for the first time. And it is saved util it's closed or reset.- Parameters:
httpURL- The http URL to connect. only used the authority part.- Returns:
- An instance of
HttpClient. - Throws:
IOException
-
getSessionInstance
public org.apache.commons.httpclient.HttpClient getSessionInstance(org.apache.commons.httpclient.HttpURL httpURL, boolean reset) throws IOException Get aHttpClientinstance. This method returns a new client instance, when reset is true.- Parameters:
httpURL- The http URL to connect. only used the authority part.reset- The reset flag to represent whether the saved information is used or not.- Returns:
- An instance of
HttpClient. - Throws:
IOException
-
setCredentials
public void setCredentials(org.apache.commons.httpclient.Credentials credentials) Set credentials for authentication.- Parameters:
credentials- The credentials to use for authentication.
-
setProxy
Set proxy info, to use proxying. -
setProxyCredentials
public void setProxyCredentials(org.apache.commons.httpclient.Credentials credentials) Set credentials for authenticating against a proxy.- Parameters:
credentials- The credentials to use for authentication.
-
closeSession
Close an session and delete the connection information.- Throws:
IOException- Error in closing socket.
-
closeSession
Deprecated.Replaced by closeSession()Close an session and delete the connection information.- Parameters:
client- The HttpClient instance.- Throws:
IOException- Error in closing socket.
-