Spring Web Services Framework

org.springframework.ws.transport.http
Class CommonsHttpConnection

java.lang.Object
  extended by org.springframework.ws.transport.AbstractWebServiceConnection
      extended by org.springframework.ws.transport.AbstractSenderConnection
          extended by org.springframework.ws.transport.http.AbstractHttpSenderConnection
              extended by org.springframework.ws.transport.http.CommonsHttpConnection
All Implemented Interfaces:
FaultAwareWebServiceConnection, WebServiceConnection

public class CommonsHttpConnection
extends AbstractHttpSenderConnection

Implementation of WebServiceConnection that is based on Jakarta Commons HttpClient. Exposes a PostMethod.

Since:
1.0.0
Author:
Arjen Poutsma

Constructor Summary
protected CommonsHttpConnection(HttpClient httpClient, PostMethod postMethod)
           
 
Method Summary
protected  void addRequestHeader(String name, String value)
          Adds a request header with the given name and value.
 PostMethod getPostMethod()
           
protected  InputStream getRawResponseInputStream()
          Returns the raw, possibly compressed input stream to read the response from.
protected  OutputStream getRequestOutputStream()
          Returns the output stream to write the request to.
protected  int getResponseCode()
          Returns the HTTP status code of the response.
protected  long getResponseContentLength()
          Returns the length of the response.
protected  Iterator getResponseHeaderNames()
          Returns an iteration over all the header names this request contains.
protected  Iterator getResponseHeaders(String name)
          Returns an iteration over all the string values of the specified header.
protected  String getResponseMessage()
          Returns the HTTP status message of the response.
 void onClose()
          Template method invoked from AbstractSenderConnection.close().
protected  void onSendAfterWrite(WebServiceMessage message)
          Called after the given message has been written to the TransportOutputStream.
protected  void onSendBeforeWrite(WebServiceMessage message)
          Called before the given message has been written to the TransportOutputStream.
 
Methods inherited from class org.springframework.ws.transport.http.AbstractHttpSenderConnection
getErrorMessage, getResponseInputStream, hasError, hasFault, hasResponse, setFault
 
Methods inherited from class org.springframework.ws.transport.AbstractSenderConnection
close, createTransportInputStream, createTransportOutputStream
 
Methods inherited from class org.springframework.ws.transport.AbstractWebServiceConnection
onReceiveAfterRead, onReceiveBeforeRead, receive, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.ws.transport.WebServiceConnection
close, receive, send
 

Constructor Detail

CommonsHttpConnection

protected CommonsHttpConnection(HttpClient httpClient,
                                PostMethod postMethod)
Method Detail

getPostMethod

public PostMethod getPostMethod()

onClose

public void onClose()
             throws IOException
Description copied from class: AbstractSenderConnection
Template method invoked from AbstractSenderConnection.close(). Default implementation is empty.

Overrides:
onClose in class AbstractSenderConnection
Throws:
IOException - if an I/O error occurs when closing this connection

onSendBeforeWrite

protected void onSendBeforeWrite(WebServiceMessage message)
                          throws IOException
Description copied from class: AbstractWebServiceConnection
Called before the given message has been written to the TransportOutputStream. Called from AbstractWebServiceConnection.send(WebServiceMessage).

Default implementation does nothing.

Overrides:
onSendBeforeWrite in class AbstractWebServiceConnection
Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

addRequestHeader

protected void addRequestHeader(String name,
                                String value)
                         throws IOException
Description copied from class: AbstractSenderConnection
Adds a request header with the given name and value. This method can be called multiple times, to allow for headers with multiple values.

Specified by:
addRequestHeader in class AbstractSenderConnection
Parameters:
name - the name of the header
value - the value of the header
Throws:
IOException

getRequestOutputStream

protected OutputStream getRequestOutputStream()
                                       throws IOException
Description copied from class: AbstractSenderConnection
Returns the output stream to write the request to.

Specified by:
getRequestOutputStream in class AbstractSenderConnection
Throws:
IOException

onSendAfterWrite

protected void onSendAfterWrite(WebServiceMessage message)
                         throws IOException
Description copied from class: AbstractWebServiceConnection
Called after the given message has been written to the TransportOutputStream. Called from AbstractWebServiceConnection.send(WebServiceMessage).

Default implementation does nothing.

Overrides:
onSendAfterWrite in class AbstractWebServiceConnection
Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

getResponseCode

protected int getResponseCode()
                       throws IOException
Description copied from class: AbstractHttpSenderConnection
Returns the HTTP status code of the response.

Specified by:
getResponseCode in class AbstractHttpSenderConnection
Throws:
IOException

getResponseMessage

protected String getResponseMessage()
                             throws IOException
Description copied from class: AbstractHttpSenderConnection
Returns the HTTP status message of the response.

Specified by:
getResponseMessage in class AbstractHttpSenderConnection
Throws:
IOException

getResponseContentLength

protected long getResponseContentLength()
                                 throws IOException
Description copied from class: AbstractHttpSenderConnection
Returns the length of the response.

Specified by:
getResponseContentLength in class AbstractHttpSenderConnection
Throws:
IOException

getRawResponseInputStream

protected InputStream getRawResponseInputStream()
                                         throws IOException
Description copied from class: AbstractHttpSenderConnection
Returns the raw, possibly compressed input stream to read the response from.

Specified by:
getRawResponseInputStream in class AbstractHttpSenderConnection
Throws:
IOException

getResponseHeaderNames

protected Iterator getResponseHeaderNames()
                                   throws IOException
Description copied from class: AbstractSenderConnection
Returns an iteration over all the header names this request contains. Returns an empty Iterator if there areno headers.

Specified by:
getResponseHeaderNames in class AbstractSenderConnection
Throws:
IOException

getResponseHeaders

protected Iterator getResponseHeaders(String name)
                               throws IOException
Description copied from class: AbstractSenderConnection
Returns an iteration over all the string values of the specified header. Returns an empty Iterator if there are no headers of the specified name.

Specified by:
getResponseHeaders in class AbstractSenderConnection
Throws:
IOException

Spring Web Services Framework

Copyright � 2005-2008 The Spring Web Services Framework. All Rights Reserved.