Class JdkHttpClientConnection
java.lang.Object
org.springframework.ws.transport.AbstractWebServiceConnection
org.springframework.ws.transport.AbstractSenderConnection
org.springframework.ws.transport.http.AbstractHttpSenderConnection
org.springframework.ws.transport.http.JdkHttpClientConnection
- All Implemented Interfaces:
AutoCloseable
,FaultAwareWebServiceConnection
,HeadersAwareSenderWebServiceConnection
,WebServiceConnection
Implementation of the
WebServiceConnection
interface that uses Java's built-in HttpClient
.- Since:
- 4.0
- Author:
- Marten Deinum
- See Also:
-
HttpClient
HttpRequest
-
Constructor Summary
ModifierConstructorDescriptionprotected
JdkHttpClientConnection
(java.net.http.HttpClient httpClient, URI uri, Duration requestTimeout) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequestHeader
(String name, String value) Adds a request header with the given name and value.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.protected 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
-
JdkHttpClientConnection
-
-
Method Details
-
getRequestOutputStream
Description copied from class:AbstractSenderConnection
Returns the output stream to write the request to.- Specified by:
getRequestOutputStream
in classAbstractSenderConnection
- 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
-
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
-
getUri
Description copied from interface:WebServiceConnection
Returns the URI for this connection.- Throws:
URISyntaxException
-
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
-
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
-
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
-
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
-