public abstract class AbstractWebServiceConnection extends Object implements WebServiceConnection
WebServiceConnection
implementations.Constructor and Description |
---|
AbstractWebServiceConnection() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this connection.
|
protected abstract TransportInputStream |
createTransportInputStream()
Returns a
TransportInputStream . |
protected abstract TransportOutputStream |
createTransportOutputStream()
Returns a
TransportOutputStream for the given message. |
protected void |
onClose()
Template method invoked from
close() . |
protected void |
onReceiveAfterRead(WebServiceMessage message)
Called when the given message has been read from the
TransportInputStream . |
protected void |
onReceiveBeforeRead()
Called before a message has been read from the
TransportInputStream . |
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 . |
WebServiceMessage |
receive(WebServiceMessageFactory messageFactory)
Receives a message using the given
WebServiceMessageFactory . |
void |
send(WebServiceMessage message)
Sends the given message using this connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getErrorMessage, getUri, hasError
public final void send(WebServiceMessage message) throws IOException
WebServiceConnection
send
in interface WebServiceConnection
message
- the message to be sentIOException
- in case of I/O errorsprotected void onSendBeforeWrite(WebServiceMessage message) throws IOException
TransportOutputStream
. Called from send(WebServiceMessage)
.
Default implementation does nothing.
message
- the messageIOException
- when an I/O exception occursprotected abstract TransportOutputStream createTransportOutputStream() throws IOException
TransportOutputStream
for the given message. Called from send(WebServiceMessage)
.IOException
- when an I/O exception occursprotected void onSendAfterWrite(WebServiceMessage message) throws IOException
TransportOutputStream
. Called from send(WebServiceMessage)
.
Default implementation does nothing.
message
- the messageIOException
- when an I/O exception occurspublic final WebServiceMessage receive(WebServiceMessageFactory messageFactory) throws IOException
WebServiceConnection
WebServiceMessageFactory
. This method blocks until it receives, or
returns null
when no message is received.receive
in interface WebServiceConnection
messageFactory
- the message factory used for reading messagesnull
if no message receivedIOException
- in case of I/O errorsprotected void onReceiveBeforeRead() throws IOException
TransportInputStream
. Called from receive(WebServiceMessageFactory)
.
Default implementation does nothing.
IOException
- when an I/O exception occursprotected abstract TransportInputStream createTransportInputStream() throws IOException
TransportInputStream
. Called from receive(WebServiceMessageFactory)
.null
if no response can be readIOException
- when an I/O exception occursprotected void onReceiveAfterRead(WebServiceMessage message) throws IOException
TransportInputStream
. Called from receive(WebServiceMessageFactory)
.
Default implementation does nothing.
message
- the messageIOException
- when an I/O exception occurspublic final void close() throws IOException
WebServiceConnection
Once a connection has been closed, it is not available for further use. A new connection needs to be created.
close
in interface AutoCloseable
close
in interface WebServiceConnection
IOException
- if an I/O error occurs when closing this connectionprotected void onClose() throws IOException
close()
. Default implementation is empty.IOException
- if an I/O error occurs when closing this connectionCopyright © 2018 Pivotal Software. All rights reserved.