public class SMimeBodyPart
extends jakarta.mail.internet.MimeBodyPart
This class shall used when creating a body part to be sent within a multipart/signed
message. When using the parent MimeBodyPart
class no canonicalization
is performed.
Constructor and Description |
---|
SMimeBodyPart()
Creates a new SMimeBodyPart.
|
SMimeBodyPart(jakarta.mail.internet.InternetHeaders headers,
byte[] content)
Creates a new SMimeBodyPart from given header and content bytes.
|
Modifier and Type | Method and Description |
---|---|
void |
checkForSMimeParts(boolean checkForSMimeParts)
Turns on/off control to use SMimeMultiparts and SMimeBodyParts insteadof MimeMultipatrs and
MimeBodyParts when supplying the content for this SMimeBodyPart.
|
void |
setDataHandler(jakarta.activation.DataHandler dh)
Sets the content wrapped by a
jakarta.activation.DataHandler . |
void |
writeTo(java.io.OutputStream os)
Writes the body part as an RFC 822 formatted stream and calculates a message
digest over the data.
|
addHeader, addHeaderLine, attachFile, attachFile, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getSize, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDescription, setDescription, setDisposition, setFileName, setHeader, setText, setText, setText, updateHeaders
public SMimeBodyPart()
public SMimeBodyPart(jakarta.mail.internet.InternetHeaders headers, byte[] content) throws jakarta.mail.MessagingException
headers
- the headerscontent
- bytes representing the body of this part.jakarta.mail.MessagingException
- if an error occurs when creating
this body partpublic void checkForSMimeParts(boolean checkForSMimeParts)
SMimeBodyPart
objects rather than using plain
MimeBodyParts. When building a multipart entity from several body parts, the SMimeBodyParts
have to be inserted into a SMimeMultipart
object instead
of using a plain MimeMultipart.
SignedContent
, SMimeMultipart
and/or SMimeBodyPart
object or generally disable
the SMimeBodyPart check throughout
the whole application environment.
When choosing the latter option by calling
SMimeParameters.setCheckForSMimeParts(false);take care to continue to use SMimeBodyParts and SMimeMultiparts when signing a newly created yet not canoinicalized content.
checkForSMimeParts
- whether to turn on/off SMimePart checkingpublic void setDataHandler(jakarta.activation.DataHandler dh) throws jakarta.mail.MessagingException
jakarta.activation.DataHandler
.setDataHandler
in interface jakarta.mail.Part
setDataHandler
in class jakarta.mail.internet.MimeBodyPart
dh
- the dataHandler wrapping the contentjakarta.mail.MessagingException
- if the content supplied by the DataHandler
cannot be accessed or the content represents
a Multipart but is not supplied as SMimeMultipart
(in the case of SMimePart control
is enabled)public void writeTo(java.io.OutputStream os) throws java.io.IOException, jakarta.mail.MessagingException
The message digest is set for the inherent JMailSMimeSigned
object to be written as next part of the multipart/signed.
writeTo
in interface jakarta.mail.Part
writeTo
in class jakarta.mail.internet.MimeBodyPart
os
- the output stream where the content shall be written tojava.io.IOException
- if an error occurs while writing to the streamjakarta.mail.MessagingException
- if an mail related error occurs