Spring Web Services Framework

org.springframework.ws.transport.jms
Class JmsSenderConnection

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

public class JmsSenderConnection
extends AbstractSenderConnection

Implementation of WebServiceConnection that is used for client-side JMS access. Exposes a BytesMessage request and response message.

Since:
1.5.0
Author:
Arjen Poutsma

Constructor Summary
protected JmsSenderConnection(ConnectionFactory connectionFactory, Connection connection, Session session, Destination requestDestination, Message requestMessage)
          Constructs a new JMS connection with the given parameters.
 
Method Summary
protected  void addRequestHeader(String name, String value)
          Adds a request header with the given name and value.
 String getErrorMessage()
          Returns the error message.
 Message getRequestMessage()
          Returns the request message for this connection.
protected  OutputStream getRequestOutputStream()
          Returns the output stream to write the request to.
protected  Iterator<String> getResponseHeaderNames()
          Returns an iteration over all the header names this request contains.
protected  Iterator<String> getResponseHeaders(String name)
          Returns an iteration over all the string values of the specified header.
protected  InputStream getResponseInputStream()
          Returns the input stream to read the response from.
 Message getResponseMessage()
          Returns the response message, if any, for this connection.
 URI getUri()
          Returns the URI for this connection.
 boolean hasError()
          Indicates whether this connection has an error.
protected  boolean hasResponse()
          Indicates whether this connection has a response.
protected  void onClose()
          Template method invoked from AbstractWebServiceConnection.close().
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.
 
Methods inherited from class org.springframework.ws.transport.AbstractSenderConnection
createTransportInputStream, createTransportOutputStream
 
Methods inherited from class org.springframework.ws.transport.AbstractWebServiceConnection
close, onReceiveAfterRead, onSendBeforeWrite, receive, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsSenderConnection

protected JmsSenderConnection(ConnectionFactory connectionFactory,
                              Connection connection,
                              Session session,
                              Destination requestDestination,
                              Message requestMessage)
                       throws JMSException
Constructs a new JMS connection with the given parameters.

Throws:
JMSException
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

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

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()

addRequestHeader

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

Specified by:
addRequestHeader in class AbstractSenderConnection
Parameters:
name - the name of the header
value - the value of the header
Throws:
IOException

getRequestOutputStream

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

Specified by:
getRequestOutputStream in class AbstractSenderConnection
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

onReceiveBeforeRead

protected void onReceiveBeforeRead()
                            throws IOException
Description copied from class: AbstractWebServiceConnection
Called before a message has been read from the TransportInputStream. Called from AbstractWebServiceConnection.receive(WebServiceMessageFactory).

Default implementation does nothing.

Overrides:
onReceiveBeforeRead in class AbstractWebServiceConnection
Throws:
IOException - when an I/O exception occurs

hasResponse

protected boolean hasResponse()
                       throws IOException
Description copied from class: AbstractSenderConnection
Indicates whether this connection has a response.

Specified by:
hasResponse in class AbstractSenderConnection
Throws:
IOException

getResponseHeaderNames

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

Specified by:
getResponseHeaderNames in class AbstractSenderConnection
Throws:
IOException

getResponseHeaders

protected Iterator<String> getResponseHeaders(String name)
                                       throws IOException
Description copied from class: AbstractSenderConnection
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:
getResponseHeaders in class AbstractSenderConnection
Throws:
IOException

getResponseInputStream

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

Specified by:
getResponseInputStream in class AbstractSenderConnection
Throws:
IOException

onClose

protected void onClose()
                throws IOException
Description copied from class: AbstractSenderConnection
Template method invoked from AbstractWebServiceConnection.close(). Default implementation is empty.

Overrides:
onClose in class AbstractSenderConnection
Throws:
IOException - if an I/O error occurs when closing this connection

Spring Web Services Framework

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