org.skunk.dav.client
Class DAVConnection

java.lang.Object
  |
  +--org.skunk.dav.client.DAVConnection

public class DAVConnection
extends java.lang.Object

An http connection that can execute DAVMethod objects.


Field Summary
static int DEFAULT_SOCKET_TIMEOUT
           
static java.lang.String SOCKET_TIMEOUT_PROPERTY
           
 
Constructor Summary
DAVConnection(java.lang.String host, int port)
          creates an DAVConnection over the http protocol
DAVConnection(java.lang.String host, int port, boolean https)
          creates a DAVConnection
 
Method Summary
 void closeConnection()
          closes the connection
 void execute(DAVMethod method)
          executes a DAVMethod
 java.lang.String getHost()
          returns the host
 int getPort()
          returns the port
 java.lang.String getProtocol()
          returns the protocol, either "http" or "https"
 int getSocketTimeout()
           
 java.lang.String getUsername()
          returns the username
 boolean isClosed()
          indicates whether the connection is closed or not
 void openConnection()
          opens the connection
protected  void processResponse(DAVMethod method, HTTPClient.HTTPResponse res)
           
 void setAuthenticator(DAVAuthenticator authenticator)
          set a DAVAuthenticator for this connection.
 void setAuthorization(java.lang.String authorization)
          sets an encoded authorization string
 void setSocketTimeout(int socketTimeout)
           
 void setUsername(java.lang.String username)
          sets the username
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOCKET_TIMEOUT_PROPERTY

public static final java.lang.String SOCKET_TIMEOUT_PROPERTY

DEFAULT_SOCKET_TIMEOUT

public static final int DEFAULT_SOCKET_TIMEOUT
Constructor Detail

DAVConnection

public DAVConnection(java.lang.String host,
                     int port)
creates an DAVConnection over the http protocol
Parameters:
host - the hostname
port - the port

DAVConnection

public DAVConnection(java.lang.String host,
                     int port,
                     boolean https)
creates a DAVConnection
Parameters:
host - the host to which to connect
port - the port on which to connect
https - whether to use https or http (https if true, http otherwise)
Method Detail

getProtocol

public java.lang.String getProtocol()
returns the protocol, either "http" or "https"
Returns:
the protocol

setAuthenticator

public void setAuthenticator(DAVAuthenticator authenticator)
set a DAVAuthenticator for this connection. the DAVAuthenticator is only being used for its requestPA() method (which provides access to the output of Authenticator's protected requestPasswordAuthentication() method)
Parameters:
authenticator - a DAVAuthenticator

setAuthorization

public void setAuthorization(java.lang.String authorization)
sets an encoded authorization string
Parameters:
authorization - the authorization string

isClosed

public boolean isClosed()
indicates whether the connection is closed or not
Returns:
whether the connection is closed

getSocketTimeout

public int getSocketTimeout()

setSocketTimeout

public void setSocketTimeout(int socketTimeout)

openConnection

public void openConnection()
opens the connection

closeConnection

public void closeConnection()
closes the connection

execute

public void execute(DAVMethod method)
             throws java.io.IOException,
                    DAVException
executes a DAVMethod
Parameters:
method - the DAVMethod instance

processResponse

protected void processResponse(DAVMethod method,
                               HTTPClient.HTTPResponse res)
                        throws java.io.IOException,
                               HTTPClient.ModuleException,
                               DAVException

getHost

public java.lang.String getHost()
returns the host
Returns:
the host

getPort

public int getPort()
returns the port
Returns:
the port

getUsername

public java.lang.String getUsername()
returns the username
Returns:
the username

setUsername

public void setUsername(java.lang.String username)
sets the username
Parameters:
username - the username