de.bea.domingo.http
Class DominoHttpClient

java.lang.Object
  extended by de.bea.domingo.monitor.AbstractMonitorEnabled
      extended by de.bea.domingo.http.DominoHttpClient
All Implemented Interfaces:
MonitorEnabled, java.io.Serializable

public final class DominoHttpClient
extends AbstractMonitorEnabled
implements java.io.Serializable

An Http client for communication with Lotus Domino.

Author:
Kurt Riede
See Also:
Serialized Form

Constructor Summary
DominoHttpClient(DNotesMonitor monitor, java.lang.String host, java.lang.String username, java.lang.String password)
          Constructor.
 
Method Summary
 DominoGetMethod createGetMethod(java.lang.String pathInfo)
          Creates and returns a new Http GET method.
 DominoPostMethod createPost(java.lang.String pathInfo)
          Creates and returns a new Http POST method.
 int executeMethod(DominoHttpMethod method)
          Executes the given HTTP method.
 int executeMethod(org.apache.commons.httpclient.HostConfiguration hostConfiguration, org.apache.commons.httpclient.HttpMethod method)
          Executes the given HTTP method using custom host configuration.
 int executeMethod(org.apache.commons.httpclient.HostConfiguration hostConfiguration, org.apache.commons.httpclient.HttpMethod method, org.apache.commons.httpclient.HttpState state)
          Executes the given HTTP method using the given custom host configuration with the given custom HTTP state.
 java.lang.String getCanonicalUserName()
          Returns the name of the current user in the canonical format.
 java.lang.String getCommonUserName()
          Returns the name of the current user in the common format.
 java.lang.String getHost()
          Returns the host name of the server.
 int getPort()
          Returns the port of the server.
 java.lang.String getProtocol()
          Returns the protocol for the connection, either http or https.
 java.lang.String getUserName()
          Returns the current user name.
 void login()
          Login to the Lotus Domino server.
 
Methods inherited from class de.bea.domingo.monitor.AbstractMonitorEnabled
getMonitor, setMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DominoHttpClient

public DominoHttpClient(DNotesMonitor monitor,
                        java.lang.String host,
                        java.lang.String username,
                        java.lang.String password)
                 throws java.net.MalformedURLException
Constructor.

Parameters:
monitor - the monitor
host - the host for the session to connect
username - the username for login
password - the password for login
Throws:
java.net.MalformedURLException - if the host is not valid
Method Detail

login

public void login()
           throws java.io.IOException
Login to the Lotus Domino server.

Throws:
java.io.IOException - if the login fails

getProtocol

public java.lang.String getProtocol()
Returns the protocol for the connection, either http or https.

Returns:
protocol

getHost

public java.lang.String getHost()
Returns the host name of the server.

Returns:
host name

getPort

public int getPort()
Returns the port of the server.

Returns:
port

getUserName

public java.lang.String getUserName()
Returns the current user name.

Returns:
username

getCommonUserName

public java.lang.String getCommonUserName()
Returns the name of the current user in the common format.

Returns:
username in common format

getCanonicalUserName

public java.lang.String getCanonicalUserName()
Returns the name of the current user in the canonical format.

Returns:
username in canonical format

executeMethod

public int executeMethod(org.apache.commons.httpclient.HostConfiguration hostConfiguration,
                         org.apache.commons.httpclient.HttpMethod method,
                         org.apache.commons.httpclient.HttpState state)
                  throws java.io.IOException
Executes the given HTTP method using the given custom host configuration with the given custom HTTP state.

Parameters:
hostConfiguration - The host configuration to use. If null, the host configuration returned by HttpClient.getHostConfiguration() will be used
method - the HTTP method to execute.
state - the HTTP state to use when executing the method. If null, the state returned by HttpClient.getState() will be used.
Returns:
the method's response code
Throws:
java.io.IOException - If an I/O (transport) error occurs. Some transport exceptions can be recovered from.

executeMethod

public int executeMethod(org.apache.commons.httpclient.HostConfiguration hostConfiguration,
                         org.apache.commons.httpclient.HttpMethod method)
                  throws java.io.IOException
Executes the given HTTP method using custom host configuration.

Parameters:
hostConfiguration - The host configuration to use. If null, the host configuration returned by HttpClient.getHostConfiguration() will be used
method - the HTTP method to execute
Returns:
the method's response code
Throws:
java.io.IOException - If an I/O (transport) error occurs. Some transport exceptions can be recovered from.

executeMethod

public int executeMethod(DominoHttpMethod method)
                  throws java.io.IOException
Executes the given HTTP method.

Parameters:
method - the HTTP method to execute
Returns:
the method's response code
Throws:
java.io.IOException - If an I/O (transport) error occurs. Some transport exceptions can be recovered from.

createPost

public DominoPostMethod createPost(java.lang.String pathInfo)
Creates and returns a new Http POST method.

Parameters:
pathInfo - the path on the server
Returns:
new POST method

createGetMethod

public DominoGetMethod createGetMethod(java.lang.String pathInfo)
Creates and returns a new Http GET method.

Parameters:
pathInfo - the path on the server
Returns:
new GET method


Domingo Java-API