public class JmsReceiverConnection extends AbstractReceiverConnection
WebServiceConnection
that is used for server-side JMS access. Exposes a BytesMessage
or TextMessage
request and response message.
The response message type is equal to the request message type, i.e. if a BytesMessage
is received as
request, a BytesMessage
is created as response, and if a TextMessage
is received, a
TextMessage
response is created.
Modifier | Constructor and Description |
---|---|
protected |
JmsReceiverConnection(javax.jms.BytesMessage requestMessage,
javax.jms.Session session)
Constructs a new JMS connection with the given
BytesMessage . |
protected |
JmsReceiverConnection(javax.jms.TextMessage requestMessage,
String encoding,
javax.jms.Session session)
Constructs a new JMS connection with the given
TextMessage . |
Modifier and Type | Method and Description |
---|---|
void |
addResponseHeader(String name,
String value)
Adds a response header with the given name and value.
|
String |
getErrorMessage()
Returns the error message.
|
Iterator<String> |
getRequestHeaderNames()
Returns an iteration over all the header names this request contains.
|
Iterator<String> |
getRequestHeaders(String name)
Returns an iteration over all the string values of the specified header.
|
protected InputStream |
getRequestInputStream()
Returns the input stream to read the response from.
|
javax.jms.Message |
getRequestMessage()
Returns the request message for this connection.
|
javax.jms.Message |
getResponseMessage()
Returns the response message, if any, for this connection.
|
protected OutputStream |
getResponseOutputStream()
Returns the output stream to write the request to.
|
URI |
getUri()
Returns the URI for this connection.
|
boolean |
hasError()
Indicates whether this connection has an error.
|
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 . |
createTransportInputStream, createTransportOutputStream, onClose
close, onReceiveAfterRead, onReceiveBeforeRead, receive, send
protected JmsReceiverConnection(javax.jms.BytesMessage requestMessage, javax.jms.Session session)
BytesMessage
.requestMessage
- the JMS request messagesession
- the JMS sessionprotected JmsReceiverConnection(javax.jms.TextMessage requestMessage, String encoding, javax.jms.Session session)
TextMessage
.requestMessage
- the JMS request messagesession
- the JMS sessionpublic javax.jms.Message getRequestMessage()
BytesMessage
or a TextMessage
.public javax.jms.Message getResponseMessage()
BytesMessage
or a TextMessage
.public URI getUri() throws URISyntaxException
WebServiceConnection
URISyntaxException
public String getErrorMessage() throws IOException
WebServiceConnection
null
when no error is presentIOException
WebServiceConnection.hasError()
public boolean hasError() throws IOException
WebServiceConnection
true
if this connection has an error; false
otherwise.IOException
public Iterator<String> getRequestHeaderNames() throws IOException
HeadersAwareReceiverWebServiceConnection
Iterator
if
there are no headers.IOException
public Iterator<String> getRequestHeaders(String name) throws IOException
HeadersAwareReceiverWebServiceConnection
Iterator
if there are no headers of the specified name.IOException
protected InputStream getRequestInputStream() throws IOException
AbstractReceiverConnection
getRequestInputStream
in class AbstractReceiverConnection
IOException
protected void onSendBeforeWrite(WebServiceMessage message) throws IOException
AbstractWebServiceConnection
TransportOutputStream
. Called from AbstractWebServiceConnection.send(WebServiceMessage)
.
Default implementation does nothing.
onSendBeforeWrite
in class AbstractWebServiceConnection
message
- the messageIOException
- when an I/O exception occurspublic void addResponseHeader(String name, String value) throws IOException
HeadersAwareReceiverWebServiceConnection
name
- the name of the headervalue
- the value of the headerIOException
protected OutputStream getResponseOutputStream() throws IOException
AbstractReceiverConnection
getResponseOutputStream
in class AbstractReceiverConnection
IOException
protected void onSendAfterWrite(WebServiceMessage message) throws IOException
AbstractWebServiceConnection
TransportOutputStream
. Called from AbstractWebServiceConnection.send(WebServiceMessage)
.
Default implementation does nothing.
onSendAfterWrite
in class AbstractWebServiceConnection
message
- the messageIOException
- when an I/O exception occursCopyright © 2018 Pivotal Software. All rights reserved.