public class HttpComponentsConnection extends AbstractHttpSenderConnection
WebServiceConnection that is based on Apache HttpClient. Exposes a HttpPost and
HttpResponse.| Modifier | Constructor and Description |
|---|---|
protected |
HttpComponentsConnection(HttpClient httpClient,
HttpPost httpPost,
HttpContext httpContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRequestHeader(String name,
String value)
Adds a request header with the given name and value.
|
HttpPost |
getHttpPost() |
HttpResponse |
getHttpResponse() |
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.
|
Iterator<String> |
getResponseHeaderNames()
Returns an iteration over all the header names this request contains.
|
Iterator<String> |
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.
|
URI |
getUri()
Returns the URI for this connection.
|
void |
onClose()
Template method invoked from
AbstractWebServiceConnection.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. |
getErrorMessage, getResponseInputStream, hasError, hasFault, hasResponse, setFault, setFaultCodecreateTransportInputStream, createTransportOutputStreamclose, onReceiveAfterRead, onReceiveBeforeRead, receive, sendclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, receive, sendprotected HttpComponentsConnection(HttpClient httpClient, HttpPost httpPost, HttpContext httpContext)
public HttpPost getHttpPost()
public HttpResponse getHttpResponse()
public void onClose()
throws IOException
AbstractSenderConnectionAbstractWebServiceConnection.close(). Default implementation is empty.onClose in class AbstractSenderConnectionIOException - if an I/O error occurs when closing this connectionpublic URI getUri() throws URISyntaxException
WebServiceConnectionURISyntaxExceptionprotected void onSendBeforeWrite(WebServiceMessage message) throws IOException
AbstractWebServiceConnectionTransportOutputStream. Called from AbstractWebServiceConnection.send(WebServiceMessage).
Default implementation does nothing.
onSendBeforeWrite in class AbstractWebServiceConnectionmessage - the messageIOException - when an I/O exception occurspublic void addRequestHeader(String name, String value) throws IOException
HeadersAwareSenderWebServiceConnectionname - the name of the headervalue - the value of the headerIOExceptionprotected OutputStream getRequestOutputStream() throws IOException
AbstractSenderConnectiongetRequestOutputStream in class AbstractSenderConnectionIOExceptionprotected void onSendAfterWrite(WebServiceMessage message) throws IOException
AbstractWebServiceConnectionTransportOutputStream. Called from AbstractWebServiceConnection.send(WebServiceMessage).
Default implementation does nothing.
onSendAfterWrite in class AbstractWebServiceConnectionmessage - the messageIOException - when an I/O exception occursprotected int getResponseCode()
throws IOException
AbstractHttpSenderConnectiongetResponseCode in class AbstractHttpSenderConnectionIOExceptionprotected String getResponseMessage() throws IOException
AbstractHttpSenderConnectiongetResponseMessage in class AbstractHttpSenderConnectionIOExceptionprotected long getResponseContentLength()
throws IOException
AbstractHttpSenderConnectiongetResponseContentLength in class AbstractHttpSenderConnectionIOExceptionprotected InputStream getRawResponseInputStream() throws IOException
AbstractHttpSenderConnectiongetRawResponseInputStream in class AbstractHttpSenderConnectionIOExceptionpublic Iterator<String> getResponseHeaderNames() throws IOException
HeadersAwareSenderWebServiceConnectionIterator if
there are no headers.IOExceptionpublic Iterator<String> getResponseHeaders(String name) throws IOException
HeadersAwareSenderWebServiceConnectionIterator
if there are no headers of the specified name.IOException