Package org.apache.axiom.om.impl
Class OMMultipartWriter
java.lang.Object
org.apache.axiom.om.impl.OMMultipartWriter
Writes a MIME multipart package as used by XOP/MTOM and SOAP with Attachments. This class wraps a
MultipartBodyWriter, providing a higher level API. In particular it will configure content
types and content transfer encodings based on information from an OMOutputFormat object.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Complete writing of the MIME multipart package.Get the content type of the root part, as determined by theOMOutputFormatpassed to the constructor of this object.voidWrite a MIME part.voidWrite a MIME part.writePart(ContentType contentType, String contentID) Start writing an attachment part of the MIME package.writePart(ContentType contentType, String contentID, List<Header> extraHeaders) Start writing an attachment part of the MIME package.voidWrite a MIME part.Start writing the root part of the MIME package.
-
Constructor Details
-
OMMultipartWriter
-
-
Method Details
-
getRootPartContentType
Get the content type of the root part, as determined by theOMOutputFormatpassed to the constructor of this object.- Returns:
- the content type of the root part
-
writeRootPart
Start writing the root part of the MIME package. This method delegates toMultipartBodyWriter.writePart(ContentType, ContentTransferEncoding, String, List), but computes the content type, content transfer encoding and content ID from theOMOutputFormat.- Returns:
- an output stream to write the content of the MIME part
- Throws:
IOException- if an I/O error occurs when writing to the underlying stream
-
writePart
Start writing an attachment part of the MIME package. This method delegates toMultipartBodyWriter.writePart(ContentType, ContentTransferEncoding, String, List), but computes the content transfer encoding based on the content type and theOMOutputFormat.- Parameters:
contentType- the content type of the MIME part to writecontentID- the content ID of the MIME part- Returns:
- an output stream to write the content of the MIME part
- Throws:
IOException- if an I/O error occurs when writing to the underlying stream
-
writePart
public OutputStream writePart(ContentType contentType, String contentID, List<Header> extraHeaders) throws IOException Start writing an attachment part of the MIME package. This method delegates toMultipartBodyWriter.writePart(ContentType, ContentTransferEncoding, String, List), but computes the content transfer encoding based on the content type and theOMOutputFormat.- Parameters:
contentType- the content type of the MIME part to writecontentID- the content ID of the MIME partextraHeaders- a list ofHeaderobjects with additional headers to write to the MIME part- Returns:
- an output stream to write the content of the MIME part
- Throws:
IOException- if an I/O error occurs when writing to the underlying stream
-
writePart
Write a MIME part. This method delegates toMultipartBodyWriter.writePart(Blob, ContentType, ContentTransferEncoding, String, List), but computes the appropriate content transfer encoding from theOMOutputFormat.- Parameters:
blob- the content of the MIME part to writecontentID- the content ID of the MIME partextraHeaders- a list ofHeaderobjects with additional headers to write to the MIME part- Throws:
IOException- if an I/O error occurs when writing the part to the underlying stream
-
writePart
Write a MIME part. This method delegates toMultipartBodyWriter.writePart(Blob, ContentType, ContentTransferEncoding, String, List), but computes the appropriate content transfer encoding from theOMOutputFormat.- Parameters:
blob- the content of the MIME part to writecontentID- the content ID of the MIME part- Throws:
IOException- if an I/O error occurs when writing the part to the underlying stream
-
writePart
Write a MIME part. This is similar towritePart(Blob, String), but optionally consumes the blob (which is only supported forPartBlobinstances).- Parameters:
blob- the content of the MIME part to writecontentID- the content ID of the MIME partpreserve- whether the content of the original MIME part should be preserved- Throws:
IOException- if an I/O error occurs when writing the part to the underlying stream
-
complete
Complete writing of the MIME multipart package. This method delegates toMultipartBodyWriter.complete().- Throws:
IOException- if an I/O error occurs when writing to the underlying stream
-