Spring Web Services Framework

org.springframework.ws.mime
Class AbstractMimeMessage

java.lang.Object
  extended by 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 Summary
AbstractMimeMessage()
           
 
Method Summary
 Attachment addAttachment(String contentId, File file)
          Add an attachment to the message, taking the content from a File.
 Attachment addAttachment(String contentId, InputStreamSource inputStreamSource, String contentType)
          Add an attachment to the message, taking the content from an InputStreamSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.ws.mime.MimeMessage
addAttachment, convertToXopPackage, getAttachment, getAttachments, isXopPackage
 
Methods inherited from interface org.springframework.ws.WebServiceMessage
getPayloadResult, getPayloadSource, writeTo
 

Constructor Detail

AbstractMimeMessage

public AbstractMimeMessage()
Method Detail

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,
                                      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

Spring Web Services Framework

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