public class AttachmentsImpl extends Object implements Attachments
Modifier and Type | Field and Description |
---|---|
protected String |
contentLocation
This is the content location as specified in SOAP with Attachments.
|
protected static org.apache.commons.logging.Log |
log |
protected MultiPartInputStream |
mpartStream
The actual stream to manage the multi-related input stream.
|
protected int |
sendtype
The form of the attachments, whether MIME or DIME.
|
protected SOAPPart |
soapPart
Field soapPart.
|
CIDprefix, SEND_TYPE_DEFAULT, SEND_TYPE_DIME, SEND_TYPE_MAX, SEND_TYPE_MIME, SEND_TYPE_MTOM, SEND_TYPE_NONE, SEND_TYPE_NOTSET
Constructor and Description |
---|
AttachmentsImpl(Object intialContents,
String contentType,
String contentLocation)
Construct one of these on a parent Message.
|
Modifier and Type | Method and Description |
---|---|
Part |
addAttachmentPart(Part newPart)
Adds an existing attachment to this list.
|
Part |
createAttachmentPart()
Create a new attachment Part in this Message.
|
Part |
createAttachmentPart(Object datahandler)
Create a new attachment Part in this Message.
|
protected DimeMultiPart |
createDimeMessage()
Creates the DIME message
|
void |
dispose()
dispose of the attachments and their files; do not use the object
after making this call.
|
Part |
getAttachmentByReference(String reference)
This method should look at a refernce and determine if it is a CID: or
url to look for attachment.
|
int |
getAttachmentCount()
This is the number of attachments.
|
Collection |
getAttachments()
This method will return all attachments as a collection.
|
Iterator |
getAttachments(MimeHeaders headers)
Retrieves all the
AttachmentPart objects
that have header entries that match the specified headers. |
long |
getContentLength()
Get the content length of the stream.
|
String |
getContentType()
Gets the content type for the whole stream.
|
IncomingAttachmentStreams |
getIncomingAttachmentStreams()
Once this method is called, attachments can only be accessed via the InputStreams.
|
Part |
getRootPart()
From the complex stream return the root part.
|
int |
getSendType()
Determine if an object is to be treated as an attchment.
|
static int |
getSendType(String value)
Determine how an object typically sent as attachments are to
be represented.
|
static String |
getSendTypeString(int value)
For a given sendType value, return a string representation.
|
boolean |
isAttachment(Object value)
Determine if an object is to be treated as an attchment.
|
void |
removeAllAttachments()
Removes all
AttachmentPart objects that have
been added to this SOAPMessage object. |
Part |
removeAttachmentPart(String reference)
This method uses getAttacmentByReference() to look for attachment.
|
void |
setAttachmentParts(Collection parts)
Add the collection of parts.
|
void |
setRootPart(Part newRoot)
Sets the root part of this multipart block
|
void |
setSendType(int sendtype)
Set the format for attachments.
|
void |
writeContentToStream(OutputStream os)
Write the content to the stream.
|
protected static org.apache.commons.logging.Log log
protected SOAPPart soapPart
protected MultiPartInputStream mpartStream
protected int sendtype
protected String contentLocation
public AttachmentsImpl(Object intialContents, String contentType, String contentLocation) throws AxisFault
intialContents
- should be anything but today only a stream is
supported.contentType
- The mime content type of the stream for transports
that provide it.contentLocation
- AxisFault
public Part removeAttachmentPart(String reference) throws AxisFault
removeAttachmentPart
in interface Attachments
reference
- The reference that referers to an attachment.AxisFault
public Part addAttachmentPart(Part newPart) throws AxisFault
addAttachmentPart
in interface Attachments
newPart
- new part to addAxisFault
public Part createAttachmentPart(Object datahandler) throws AxisFault
Attachments
createAttachmentPart
in interface Attachments
datahandler
- The part that is referencedAxisFault
public void setAttachmentParts(Collection parts) throws AxisFault
setAttachmentParts
in interface Attachments
parts
- AxisFault
public Part getAttachmentByReference(String reference) throws AxisFault
getAttachmentByReference
in interface Attachments
reference
- The reference in the xml that referers to an attachment.AxisFault
public Collection getAttachments() throws AxisFault
getAttachments
in interface Attachments
AxisFault
public Part getRootPart()
getRootPart
in interface Attachments
Part
public void setRootPart(Part newRoot)
Attachments
setRootPart
in interface Attachments
newRoot
- the new root Part
public long getContentLength() throws AxisFault
getContentLength
in interface Attachments
AxisFault
protected DimeMultiPart createDimeMessage() throws AxisFault
AxisFault
- if the part could not be builtpublic void writeContentToStream(OutputStream os) throws AxisFault
writeContentToStream
in interface Attachments
os
- AxisFault
public String getContentType() throws AxisFault
getContentType
in interface Attachments
AxisFault
public int getAttachmentCount()
getAttachmentCount
in interface Attachments
public boolean isAttachment(Object value)
isAttachment
in interface Attachments
value
- the value that is to be determined if
its an attachment.public void removeAllAttachments()
AttachmentPart
objects that have
been added to this SOAPMessage
object.
This method does not touch the SOAP part.
removeAllAttachments
in interface Attachments
public Iterator getAttachments(MimeHeaders headers)
AttachmentPart
objects
that have header entries that match the specified headers.
Note that a returned attachment could have headers in
addition to those specified.getAttachments
in interface Attachments
headers
- a MimeHeaders
object containing the MIME headers for which to
searchpublic Part createAttachmentPart() throws AxisFault
createAttachmentPart
in interface Attachments
AxisFault
public void setSendType(int sendtype)
Attachments
setSendType
in interface Attachments
sendtype
- the format to send.
SEND_TYPE_MIME for Multipart Releated Mail type attachments.
SEND_TYPE_DIME for DIME type attachments.public int getSendType()
Attachments
getSendType
in interface Attachments
public void dispose()
dispose
in interface Attachments
public static int getSendType(String value)
value
- a String representing a sending type, treated in a
case-insensetive mannerint
send type codepublic static String getSendTypeString(int value)
value
- a type code integerString
representation of value
public IncomingAttachmentStreams getIncomingAttachmentStreams()
getIncomingAttachmentStreams
in interface Attachments
Copyright © The Apache Software Foundation. All Rights Reserved.