Class MailSenderConnection
java.lang.Object
org.springframework.ws.transport.AbstractWebServiceConnection
org.springframework.ws.transport.AbstractSenderConnection
org.springframework.ws.transport.mail.MailSenderConnection
- All Implemented Interfaces:
AutoCloseable,HeadersAwareSenderWebServiceConnection,WebServiceConnection
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, Greg Turnquist
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMailSenderConnection(jakarta.mail.Session session, jakarta.mail.URLName transportUri, jakarta.mail.URLName storeUri, jakarta.mail.internet.InternetAddress to, long receiveTimeout) Constructs a new Mail connection with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequestHeader(String name, String value) Adds a request header with the given name and value.Returns the error message.jakarta.mail.MessageReturns the request message for this connection.protected OutputStreamReturns the output stream to write the request to.Returns an iteration over all the header names this request contains.getResponseHeaders(String name) Returns an iteration over all the string values of the specified header.protected InputStreamReturns the input stream to read the response from.jakarta.mail.MessageReturns the response message, if any, for this connection.getUri()Returns the URI for this connection.booleanhasError()Indicates whether this connection has an error.protected booleanIndicates whether this connection has a response.voidonClose()Template method invoked fromAbstractWebServiceConnection.close().protected voidCalled before a message has been read from theTransportInputStream.protected voidonSendAfterWrite(WebServiceMessage message) Called after the given message has been written to theTransportOutputStream.protected voidonSendBeforeWrite(WebServiceMessage message) Called before the given message has been written to theTransportOutputStream.Methods inherited from class org.springframework.ws.transport.AbstractSenderConnection
createTransportInputStream, createTransportOutputStreamMethods inherited from class org.springframework.ws.transport.AbstractWebServiceConnection
close, onReceiveAfterRead, receive, send
-
Constructor Details
-
MailSenderConnection
protected MailSenderConnection(jakarta.mail.Session session, jakarta.mail.URLName transportUri, jakarta.mail.URLName storeUri, jakarta.mail.internet.InternetAddress to, long receiveTimeout) Constructs a new Mail connection with the given parameters.
-
-
Method Details
-
getRequestMessage
public jakarta.mail.Message getRequestMessage()Returns the request message for this connection. -
getResponseMessage
public jakarta.mail.Message getResponseMessage()Returns the response message, if any, for this connection. -
getUri
Description copied from interface:WebServiceConnectionReturns the URI for this connection.- Throws:
URISyntaxException
-
onSendBeforeWrite
Description copied from class:AbstractWebServiceConnectionCalled before the given message has been written to theTransportOutputStream. Called fromAbstractWebServiceConnection.send(WebServiceMessage).Default implementation does nothing.
- Overrides:
onSendBeforeWritein classAbstractWebServiceConnection- Parameters:
message- the message- Throws:
IOException- when an I/O exception occurs
-
addRequestHeader
Description copied from interface:HeadersAwareSenderWebServiceConnectionAdds a request header with the given name and value. This method can be called multiple times, to allow for headers with multiple values.- Parameters:
name- the name of the headervalue- the value of the header- Throws:
IOException
-
getRequestOutputStream
Description copied from class:AbstractSenderConnectionReturns the output stream to write the request to.- Specified by:
getRequestOutputStreamin classAbstractSenderConnection- Throws:
IOException
-
onSendAfterWrite
Description copied from class:AbstractWebServiceConnectionCalled after the given message has been written to theTransportOutputStream. Called fromAbstractWebServiceConnection.send(WebServiceMessage).Default implementation does nothing.
- Overrides:
onSendAfterWritein classAbstractWebServiceConnection- Parameters:
message- the message- Throws:
IOException- when an I/O exception occurs
-
onReceiveBeforeRead
Description copied from class:AbstractWebServiceConnectionCalled before a message has been read from theTransportInputStream. Called fromAbstractWebServiceConnection.receive(WebServiceMessageFactory).Default implementation does nothing.
- Overrides:
onReceiveBeforeReadin classAbstractWebServiceConnection- Throws:
IOException- when an I/O exception occurs
-
hasResponse
Description copied from class:AbstractSenderConnectionIndicates whether this connection has a response.- Specified by:
hasResponsein classAbstractSenderConnection- Throws:
IOException
-
getResponseHeaderNames
Description copied from interface:HeadersAwareSenderWebServiceConnectionReturns an iteration over all the header names this request contains. Returns an emptyIteratorif there are no headers.- Throws:
IOException
-
getResponseHeaders
Description copied from interface:HeadersAwareSenderWebServiceConnectionReturns an iteration over all the string values of the specified header. Returns an emptyIteratorif there are no headers of the specified name.- Throws:
IOException
-
getResponseInputStream
Description copied from class:AbstractSenderConnectionReturns the input stream to read the response from.- Specified by:
getResponseInputStreamin classAbstractSenderConnection- Throws:
IOException
-
hasError
Description copied from interface:WebServiceConnectionIndicates whether this connection has an error. Typically, error detection is done by inspecting connection error codes, etc.- Returns:
trueif this connection has an error;falseotherwise.- Throws:
IOException
-
getErrorMessage
Description copied from interface:WebServiceConnectionReturns the error message.- Returns:
- the connection error message, if any; returns
nullwhen no error is present - Throws:
IOException- See Also:
-
onClose
Description copied from class:AbstractSenderConnectionTemplate method invoked fromAbstractWebServiceConnection.close(). Default implementation is empty.- Overrides:
onClosein classAbstractSenderConnection- Throws:
IOException- if an I/O error occurs when closing this connection
-