public class Attachments extends java.lang.Object implements OMAttachmentAccessor
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
applicationType
applicationType used to distinguish between MTOM & SWA If the message is MTOM
optimised type is application/xop+xml If the message is SWA, type is ??have to find out |
private AttachmentsDelegate |
delegate |
| Constructor and Description |
|---|
Attachments()
Use this constructor when instantiating this to store the attachments set programatically
through the SwA API.
|
Attachments(java.io.InputStream inStream,
java.lang.String contentTypeString)
Sets file cache to false.
|
Attachments(java.io.InputStream inStream,
java.lang.String contentTypeString,
boolean fileCacheEnable,
java.lang.String attachmentRepoDir,
java.lang.String fileThreshold)
Moves the pointer to the beginning of the first MIME part.
|
Attachments(java.io.InputStream inStream,
java.lang.String contentTypeString,
boolean fileCacheEnable,
java.lang.String attachmentRepoDir,
java.lang.String fileThreshold,
int contentLength)
Moves the pointer to the beginning of the first MIME part.
|
Attachments(LifecycleManager manager,
java.io.InputStream inStream,
java.lang.String contentTypeString,
boolean fileCacheEnable,
java.lang.String attachmentRepoDir,
java.lang.String fileThreshold)
Moves the pointer to the beginning of the first MIME part.
|
Attachments(LifecycleManager manager,
java.io.InputStream inStream,
java.lang.String contentTypeString,
boolean fileCacheEnable,
java.lang.String attachmentRepoDir,
java.lang.String fileThreshold,
int contentLength)
Moves the pointer to the beginning of the first MIME part.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDataHandler(java.lang.String contentID,
javax.activation.DataHandler dataHandler)
Programatically adding an SOAP with Attachments(SwA) Attachment.
|
java.lang.String[] |
getAllContentIDs()
Get the content IDs of all MIME parts in the message.
|
java.lang.String |
getAttachmentSpecType()
Identify the type of message (MTOM or SOAP with attachments) represented by this object.
|
java.util.List |
getContentIDList()
Get the content IDs of the already loaded MIME parts in the message.
|
java.util.Set |
getContentIDSet()
Get the content IDs of all MIME parts in the message.
|
long |
getContentLength()
If the Attachments is backed by an InputStream, then this
method returns the length of the message contents
(Length of the entire message - Length of the Transport Headers)
|
javax.activation.DataHandler |
getDataHandler(java.lang.String contentID)
Get the
DataHandler object for the MIME part with a given content ID. |
java.io.InputStream |
getIncomingAttachmentsAsSingleStream()
Deprecated.
As of Axiom 1.2.13, this method is no longer supported.
|
IncomingAttachmentStreams |
getIncomingAttachmentStreams()
Stream based access
|
LifecycleManager |
getLifecycleManager() |
java.util.Map |
getMap()
Get a map of all MIME parts in the message.
|
java.lang.String |
getRootPartContentID()
Get the content ID of the root part of the MIME message.
|
java.lang.String |
getRootPartContentType()
Get the content type of the root part of the MIME message.
|
java.io.InputStream |
getRootPartInputStream()
Get an input stream for the root part of the MIME message.
|
java.io.InputStream |
getRootPartInputStream(boolean preserve)
Get an input stream for the root part of the MIME message.
|
java.lang.String |
getSOAPPartContentID()
Deprecated.
Use
getRootPartContentID() instead. |
java.lang.String |
getSOAPPartContentType()
Deprecated.
Use
getRootPartContentType() instead. |
java.io.InputStream |
getSOAPPartInputStream()
Deprecated.
Use
getRootPartInputStream() instead. |
void |
removeDataHandler(java.lang.String blobContentID)
Removes the DataHandler corresponding to the given contenID.
|
void |
setLifecycleManager(LifecycleManager manager) |
private final AttachmentsDelegate delegate
private java.lang.String applicationType
applicationType used to distinguish between MTOM & SWA If the message is MTOM
optimised type is application/xop+xml If the message is SWA, type is ??have to find outpublic Attachments(LifecycleManager manager, java.io.InputStream inStream, java.lang.String contentTypeString, boolean fileCacheEnable, java.lang.String attachmentRepoDir, java.lang.String fileThreshold) throws OMException
inStream - contentTypeString - fileCacheEnable - attachmentRepoDir - OMExceptionpublic Attachments(LifecycleManager manager, java.io.InputStream inStream, java.lang.String contentTypeString, boolean fileCacheEnable, java.lang.String attachmentRepoDir, java.lang.String fileThreshold, int contentLength) throws OMException
inStream - contentTypeString - fileCacheEnable - attachmentRepoDir - fileThreshold - contentLength - OMExceptionpublic Attachments(java.io.InputStream inStream,
java.lang.String contentTypeString,
boolean fileCacheEnable,
java.lang.String attachmentRepoDir,
java.lang.String fileThreshold)
throws OMException
inStream - contentTypeString - fileCacheEnable - attachmentRepoDir - OMExceptionpublic Attachments(java.io.InputStream inStream,
java.lang.String contentTypeString,
boolean fileCacheEnable,
java.lang.String attachmentRepoDir,
java.lang.String fileThreshold,
int contentLength)
throws OMException
inStream - contentTypeString - fileCacheEnable - attachmentRepoDir - fileThreshold - contentLength - OMExceptionpublic Attachments(java.io.InputStream inStream,
java.lang.String contentTypeString)
throws OMException
inStream - contentTypeString - OMExceptionpublic Attachments()
public LifecycleManager getLifecycleManager()
public void setLifecycleManager(LifecycleManager manager)
public java.lang.String getAttachmentSpecType()
MTOMConstants.MTOM_TYPE, MTOMConstants.SWA_TYPE or
MTOMConstants.SWA_TYPE_12 constants.OMException - if the message doesn't have one of the supported types (i.e. is neither MTOM nor
SOAP with attachments) or if the instance was not created from a streampublic javax.activation.DataHandler getDataHandler(java.lang.String contentID)
DataHandler object for the MIME part with a given content ID. The returned
instance MAY implement DataHandlerExt in which case the caller can use that API to
stream the content of the part. In addition, the DataSource linked to the returned
DataHandler MAY be of type SizeAwareDataSource in which case the caller can
use that interface to determine the size of the MIME part.getDataHandler in interface OMAttachmentAccessorcontentID - the raw content ID (without the surrounding angle brackets and cid:
prefix) of the MIME partDataHandler of the MIME part referred by the content ID or
null if the MIME part referred by the content ID does not existpublic void addDataHandler(java.lang.String contentID,
javax.activation.DataHandler dataHandler)
contentID - dataHandler - public void removeDataHandler(java.lang.String blobContentID)
blobContentID - public java.io.InputStream getSOAPPartInputStream()
throws OMException
getRootPartInputStream() instead.OMExceptionpublic java.lang.String getSOAPPartContentID()
getRootPartContentID() instead.public java.lang.String getSOAPPartContentType()
getRootPartContentType() instead.public java.io.InputStream getRootPartInputStream()
throws OMException
getRootPartContentID() method. Note that a new
stream is returned each time this method is called, i.e. the method does not consume the root
part. Instead it loads the root part into memory so that it can be read several times.OMExceptionpublic java.io.InputStream getRootPartInputStream(boolean preserve)
throws OMException
getRootPartInputStream(), but can be instructed to consume the root part. This
allows streaming of the root part. If that feature is used, the root part will not be loaded
into memory unless an attempt is made to access another part of the MIME message, in which
case the remaining (i.e. unconsumed) content of the root part will be buffered. If the
feature is not enabled, then this method behaves in the same way as
getRootPartInputStream().preserve - true if the content of the root part should be fetched into memory so
that it can be read several times, false if the root part should be
consumedOMExceptionpublic java.lang.String getRootPartContentID()
public java.lang.String getRootPartContentType()
getRootPartContentID() method.OMException - if the content type could not be determinedpublic IncomingAttachmentStreams getIncomingAttachmentStreams() throws java.lang.IllegalStateException
IncomingAttachmentStreamsjava.lang.IllegalStateException - if application has alreadt started using Part's directlypublic java.lang.String[] getAllContentIDs()
public java.util.Set getContentIDSet()
public java.util.Map getMap()
DataHandler objects as values.public java.util.List getContentIDList()
getAllContentIDs() or getContentIDSet() should be used
instead.public long getContentLength()
throws java.io.IOException
java.io.IOExceptionpublic java.io.InputStream getIncomingAttachmentsAsSingleStream()
throws java.lang.IllegalStateException
java.lang.IllegalStateException