Class HttpComponentsConnection
java.lang.Object
org.springframework.ws.transport.AbstractWebServiceConnection
org.springframework.ws.transport.AbstractSenderConnection
org.springframework.ws.transport.http.AbstractHttpSenderConnection
org.springframework.ws.transport.http.HttpComponentsConnection
- All Implemented Interfaces:
AutoCloseable
,FaultAwareWebServiceConnection
,HeadersAwareSenderWebServiceConnection
,WebServiceConnection
Implementation of
WebServiceConnection
that is based on Apache HttpClient. Exposes a HttpPost
and
HttpResponse
.- Since:
- 2.1.0
- Author:
- Alan Stewart, Barry Pitman, Arjen Poutsma, Greg Turnquist
-
Constructor Summary
ModifierConstructorDescriptionprotected
HttpComponentsConnection
(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpPost httpPost, org.apache.http.protocol.HttpContext httpContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequestHeader
(String name, String value) Adds a request header with the given name and value.org.apache.http.client.methods.HttpPost
org.apache.http.HttpResponse
protected InputStream
Returns the raw, possibly compressed input stream to read the response from.protected OutputStream
Returns the output stream to write the request to.protected int
Returns the HTTP status code of the response.protected long
Returns the length of the response.Returns an iteration over all the header names this request contains.getResponseHeaders
(String name) Returns an iteration over all the string values of the specified header.protected String
Returns the HTTP status message of the response.getUri()
Returns the URI for this connection.void
onClose()
Template method invoked fromAbstractWebServiceConnection.close()
.protected void
onSendAfterWrite
(WebServiceMessage message) Called after the given message has been written to theTransportOutputStream
.protected void
onSendBeforeWrite
(WebServiceMessage message) Called before the given message has been written to theTransportOutputStream
.Methods inherited from class org.springframework.ws.transport.http.AbstractHttpSenderConnection
getErrorMessage, getResponseInputStream, hasError, hasFault, hasResponse, setFault, setFaultCode
Methods inherited from class org.springframework.ws.transport.AbstractSenderConnection
createTransportInputStream, createTransportOutputStream
Methods inherited from class org.springframework.ws.transport.AbstractWebServiceConnection
close, 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 Details
-
HttpComponentsConnection
protected HttpComponentsConnection(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpPost httpPost, org.apache.http.protocol.HttpContext httpContext)
-
-
Method Details
-
getHttpPost
public org.apache.http.client.methods.HttpPost getHttpPost() -
getHttpResponse
public org.apache.http.HttpResponse getHttpResponse() -
onClose
Description copied from class:AbstractSenderConnection
Template method invoked fromAbstractWebServiceConnection.close()
. Default implementation is empty.- Overrides:
onClose
in classAbstractSenderConnection
- Throws:
IOException
- if an I/O error occurs when closing this connection
-
getUri
Description copied from interface:WebServiceConnection
Returns the URI for this connection.- Throws:
URISyntaxException
-
onSendBeforeWrite
Description copied from class:AbstractWebServiceConnection
Called before the given message has been written to theTransportOutputStream
. Called fromAbstractWebServiceConnection.send(WebServiceMessage)
.Default implementation does nothing.
- Overrides:
onSendBeforeWrite
in classAbstractWebServiceConnection
- Parameters:
message
- the message- Throws:
IOException
- when an I/O exception occurs
-
addRequestHeader
Description copied from interface:HeadersAwareSenderWebServiceConnection
Adds a request header with the given name and value. This method can be called multiple times, to allow for headers with multiple values.- Parameters:
name
- the name of the headervalue
- the value of the header- Throws:
IOException
-
getRequestOutputStream
Description copied from class:AbstractSenderConnection
Returns the output stream to write the request to.- Specified by:
getRequestOutputStream
in classAbstractSenderConnection
- Throws:
IOException
-
onSendAfterWrite
Description copied from class:AbstractWebServiceConnection
Called after the given message has been written to theTransportOutputStream
. Called fromAbstractWebServiceConnection.send(WebServiceMessage)
.Default implementation does nothing.
- Overrides:
onSendAfterWrite
in classAbstractWebServiceConnection
- Parameters:
message
- the message- Throws:
IOException
- when an I/O exception occurs
-
getResponseCode
Description copied from class:AbstractHttpSenderConnection
Returns the HTTP status code of the response.- Specified by:
getResponseCode
in classAbstractHttpSenderConnection
- Throws:
IOException
-
getResponseMessage
Description copied from class:AbstractHttpSenderConnection
Returns the HTTP status message of the response.- Specified by:
getResponseMessage
in classAbstractHttpSenderConnection
- Throws:
IOException
-
getResponseContentLength
Description copied from class:AbstractHttpSenderConnection
Returns the length of the response.- Specified by:
getResponseContentLength
in classAbstractHttpSenderConnection
- Throws:
IOException
-
getRawResponseInputStream
Description copied from class:AbstractHttpSenderConnection
Returns the raw, possibly compressed input stream to read the response from.- Specified by:
getRawResponseInputStream
in classAbstractHttpSenderConnection
- Throws:
IOException
-
getResponseHeaderNames
Description copied from interface:HeadersAwareSenderWebServiceConnection
Returns an iteration over all the header names this request contains. Returns an emptyIterator
if there are no headers.- Throws:
IOException
-
getResponseHeaders
Description copied from interface:HeadersAwareSenderWebServiceConnection
Returns an iteration over all the string values of the specified header. Returns an emptyIterator
if there are no headers of the specified name.- Throws:
IOException
-