Class AbstractMimeMessage

java.lang.Object
org.springframework.ws.mime.AbstractMimeMessage
All Implemented Interfaces:
MimeMessage, WebServiceMessage
Direct Known Subclasses:
AbstractSoapMessage

public abstract class AbstractMimeMessage extends Object implements MimeMessage
Abstract implementation of the MimeMessage interface. Contains convenient default implementations.
Since:
1.0.0
Author:
Arjen Poutsma
  • Constructor Details

    • AbstractMimeMessage

      public AbstractMimeMessage()
  • Method Details

    • addAttachment

      public final Attachment addAttachment(String contentId, File file) throws AttachmentException
      Description copied from interface: MimeMessage
      Add an attachment to the message, taking the content from a File.

      The content type will be determined by the name of the given content file. Do not use this for temporary files with arbitrary filenames (possibly ending in ".tmp" or the like)!

      Specified by:
      addAttachment in interface MimeMessage
      Parameters:
      contentId - the content Id of the attachment
      file - the file to take the content from
      Returns:
      the added attachment
      Throws:
      AttachmentException - in case of errors
    • addAttachment

      public final Attachment addAttachment(String contentId, org.springframework.core.io.InputStreamSource inputStreamSource, String contentType)
      Description copied from interface: MimeMessage
      Add an attachment to the message, taking the content from an InputStreamSource.

      Note that the stream returned by the source needs to be a fresh one on each call, as underlying implementations can invoke InputStreamSource.getInputStream() multiple times.

      Specified by:
      addAttachment in interface MimeMessage
      Parameters:
      contentId - the content Id of the attachment
      inputStreamSource - the resource to take the content from (all of Spring's Resource implementations can be passed in here)
      contentType - the content type to use for the element
      Returns:
      the added attachment
      See Also:
      • Resource