Spring Web Services Framework

org.springframework.ws.transport.mail
Class MailSenderConnection

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

public class MailSenderConnection
extends AbstractSenderConnection

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

Since:
1.5.0
Author:
Arjen Poutsma

Constructor Summary
protected MailSenderConnection(Session session, URLName transportUri, URLName storeUri, InternetAddress to, long receiveTimeout)
          Constructs a new Mail 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 getResponseHeaderNames()
          Returns an iteration over all the header names this request contains.
protected  Iterator 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.
 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.
protected  void onSendBeforeWrite(WebServiceMessage message)
          Called before 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, receive, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailSenderConnection

protected MailSenderConnection(Session session,
                               URLName transportUri,
                               URLName storeUri,
                               InternetAddress to,
                               long receiveTimeout)
Constructs a new Mail connection with the given parameters.

Method Detail

getRequestMessage

public Message getRequestMessage()
Returns the request message for this connection.


getResponseMessage

public Message getResponseMessage()
Returns the response message, if any, for this connection.


getUri

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

Throws:
URISyntaxException

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

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 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 areno headers.

Specified by:
getResponseHeaderNames in class AbstractSenderConnection
Throws:
IOException

getResponseHeaders

protected Iterator 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

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

onClose

public 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-2010 The Spring Web Services Framework. All Rights Reserved.