Spring Web Services Framework

org.springframework.ws.transport.jms
Class JmsReceiverConnection

java.lang.Object
  extended by org.springframework.ws.transport.AbstractWebServiceConnection
      extended by org.springframework.ws.transport.AbstractReceiverConnection
          extended by org.springframework.ws.transport.jms.JmsReceiverConnection
All Implemented Interfaces:
WebServiceConnection

public class JmsReceiverConnection
extends AbstractReceiverConnection

Implementation of 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.

Since:
1.5.0
Author:
Arjen Poutsma

Constructor Summary
protected JmsReceiverConnection(BytesMessage requestMessage, Session session)
          Constructs a new JMS connection with the given BytesMessage.
protected JmsReceiverConnection(TextMessage requestMessage, String encoding, Session session)
          Constructs a new JMS connection with the given TextMessage.
 
Method Summary
protected  void addResponseHeader(String name, String value)
          Adds a response header with the given name and value.
 String getErrorMessage()
          Returns the error message.
protected  Iterator<String> getRequestHeaderNames()
          Returns an iteration over all the header names this request contains.
protected  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.
 Message getRequestMessage()
          Returns the request message for this connection.
 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.
 
Methods inherited from class org.springframework.ws.transport.AbstractReceiverConnection
createTransportInputStream, createTransportOutputStream, onClose
 
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
 

Constructor Detail

JmsReceiverConnection

protected JmsReceiverConnection(BytesMessage requestMessage,
                                Session session)
Constructs a new JMS connection with the given BytesMessage.

Parameters:
requestMessage - the JMS request message
session - the JMS session

JmsReceiverConnection

protected JmsReceiverConnection(TextMessage requestMessage,
                                String encoding,
                                Session session)
Constructs a new JMS connection with the given TextMessage.

Parameters:
requestMessage - the JMS request message
session - the JMS session
Method Detail

getRequestMessage

public Message getRequestMessage()
Returns the request message for this connection. Returns either a BytesMessage or a TextMessage.


getResponseMessage

public Message getResponseMessage()
Returns the response message, if any, for this connection. Returns either a BytesMessage or a TextMessage.


getUri

public URI getUri()
           throws URISyntaxException
Description copied from interface: WebServiceConnection
Returns the URI for this connection.

Throws:
URISyntaxException

getErrorMessage

public String getErrorMessage()
                       throws IOException
Description copied from interface: WebServiceConnection
Returns the error message.

Returns:
the connection error message, if any; returns null when no error is present
Throws:
IOException
See Also:
WebServiceConnection.hasError()

hasError

public boolean hasError()
                 throws IOException
Description copied from interface: WebServiceConnection
Indicates whether this connection has an error. Typically, error detection is done by inspecting connection error codes, etc.

Returns:
true if this connection has an error; false otherwise.
Throws:
IOException

getRequestHeaderNames

protected Iterator<String> getRequestHeaderNames()
                                          throws IOException
Description copied from class: AbstractReceiverConnection
Returns an iteration over all the header names this request contains. Returns an empty Iterator if there are no headers.

Specified by:
getRequestHeaderNames in class AbstractReceiverConnection
Throws:
IOException

getRequestHeaders

protected Iterator<String> getRequestHeaders(String name)
                                      throws IOException
Description copied from class: AbstractReceiverConnection
Returns an iteration over all the string values of the specified header. Returns an empty Iterator if there are no headers of the specified name.

Specified by:
getRequestHeaders in class AbstractReceiverConnection
Throws:
IOException

getRequestInputStream

protected InputStream getRequestInputStream()
                                     throws IOException
Description copied from class: AbstractReceiverConnection
Returns the input stream to read the response from.

Specified by:
getRequestInputStream in class AbstractReceiverConnection
Throws:
IOException

onSendBeforeWrite

protected void onSendBeforeWrite(WebServiceMessage message)
                          throws IOException
Description copied from class: AbstractWebServiceConnection
Called before the given message has been written to the TransportOutputStream. Called from AbstractWebServiceConnection.send(WebServiceMessage).

Default implementation does nothing.

Overrides:
onSendBeforeWrite in class AbstractWebServiceConnection
Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

addResponseHeader

protected void addResponseHeader(String name,
                                 String value)
                          throws IOException
Description copied from class: AbstractReceiverConnection
Adds a response header with the given name and value. This method can be called multiple times, to allow for headers with multiple values.

Specified by:
addResponseHeader in class AbstractReceiverConnection
Parameters:
name - the name of the header
value - the value of the header
Throws:
IOException

getResponseOutputStream

protected OutputStream getResponseOutputStream()
                                        throws IOException
Description copied from class: AbstractReceiverConnection
Returns the output stream to write the request to.

Specified by:
getResponseOutputStream in class AbstractReceiverConnection
Throws:
IOException

onSendAfterWrite

protected void onSendAfterWrite(WebServiceMessage message)
                         throws IOException
Description copied from class: AbstractWebServiceConnection
Called after the given message has been written to the TransportOutputStream. Called from AbstractWebServiceConnection.send(WebServiceMessage).

Default implementation does nothing.

Overrides:
onSendAfterWrite in class AbstractWebServiceConnection
Parameters:
message - the message
Throws:
IOException - when an I/O exception occurs

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.