org.jcoderz.commons.connector.http.transport
Interface HttpClientConnection

All Known Implementing Classes:
HttpClientConnectionImpl

public interface HttpClientConnection

Interface used by the commons http connector to use the jakarta commons-httpclient.


Method Summary
 void closeConnection()
          Closes the physical connection.
 void establishConnection(String url, int connectTimeout, int readTimeout)
          Establishes the connection to the target host using the given parameter values.
 void execute()
          Executes sending the request and receiving the response.
 byte[] getResponseBody()
          Gets the response body received from the target host.
 String getResponseHeader(String key)
          Gets the response header parameter value for a given key.
 void initSsl(KeyStore keyStore, KeyStore trustStore, String keyAlias, String keyAliasPassword)
          Sets parameter necessary for SSL connection.
 void initSsl(String keyAlias, String keyAliasPassword)
          Sets parameter necessary for SSL connection.
 void releaseConnection()
          Releases the connection for reuse.
 void setEventListener(HttpConnectorEventListener listener, ConnectorContext context)
          Sets the event listener used for SLA logging.
 void setRequestBody(InputStream body)
          Sets the request body to send.
 void setRequestResponseHeader(HttpRequestResponseHeader header)
          Sets request header to send and response header to validate.
 

Method Detail

establishConnection

void establishConnection(String url,
                         int connectTimeout,
                         int readTimeout)
Establishes the connection to the target host using the given parameter values. At this step only the underlaying objects will be created and initializied. The physical connection will be open later on.

Parameters:
url - the URL to connect to
connectTimeout - the connect timeout used for connecting the host
readTimeout - the read timeout used whilst reading the response from the target host

releaseConnection

void releaseConnection()
Releases the connection for reuse. The physical connection is afterwards still open.


closeConnection

void closeConnection()
Closes the physical connection.


execute

void execute()
             throws HttpConnectionException
Executes sending the request and receiving the response.

Throws:
HttpConnectionException - in case of a connection failure

setRequestBody

void setRequestBody(InputStream body)
Sets the request body to send.

Parameters:
body - the message body to send

getResponseBody

byte[] getResponseBody()
                       throws HttpEmptyResponseException
Gets the response body received from the target host.

Returns:
byte[] - the body of the response message
Throws:
HttpEmptyResponseException - if response body is empty

getResponseHeader

String getResponseHeader(String key)
Gets the response header parameter value for a given key.

Parameters:
key - the parameter key to obtain the value for
Returns:
String - the parameter value for the given key

initSsl

void initSsl(KeyStore keyStore,
             KeyStore trustStore,
             String keyAlias,
             String keyAliasPassword)
Sets parameter necessary for SSL connection.

Parameters:
keyStore - the keystore given from Signature Service
trustStore - the truststore given from Signature Service
keyAlias - the alias of the key used from keystore
keyAliasPassword - the password of the key in use

initSsl

void initSsl(String keyAlias,
             String keyAliasPassword)
Sets parameter necessary for SSL connection. Here: the keystores are loaded from the file system.

Parameters:
keyAlias - the alias of the key used from keystore
keyAliasPassword - the password of the key in use

setEventListener

void setEventListener(HttpConnectorEventListener listener,
                      ConnectorContext context)
Sets the event listener used for SLA logging.

Parameters:
listener - the listener to set
context - the context to set

setRequestResponseHeader

void setRequestResponseHeader(HttpRequestResponseHeader header)
Sets request header to send and response header to validate.

Parameters:
header - the header object


Copyright 2007 The jCoderZ Project.