public class SMimeMultipart
extends jakarta.mail.internet.MimeMultipart
This class shall used when creating a multipart object to be send within a
multipart/signed message. When using the parent MimeMultipart
class no canonicalization is performed.
Constructor and Description |
---|
SMimeMultipart()
Default constructor.
|
SMimeMultipart(jakarta.activation.DataSource ds)
Creates a new MimeMultipart and its bodyparts from the given DataSource.
|
SMimeMultipart(java.lang.String subtype)
Creates a new MimeMultipart for the given subtype.
|
Modifier and Type | Method and Description |
---|---|
void |
addBodyPart(jakarta.mail.BodyPart part)
Adds a body part.
|
void |
addBodyPart(jakarta.mail.BodyPart part,
int index)
Inserts a body part at the given index.
|
void |
checkForSMimeParts(boolean checkForSMimeParts)
Turns on/off control to use SMimeBodyParts insteadof MimeBodyParts when
adding a bodypart to this multipart. |
protected void |
updateHeaders()
Updates the headers of all included body parts.
|
createInternetHeaders, createMimeBodyPart, createMimeBodyPart, getBodyPart, getBodyPart, getCount, getPreamble, initializeProperties, isComplete, parse, removeBodyPart, removeBodyPart, setPreamble, setSubType, writeTo
public SMimeMultipart()
public SMimeMultipart(jakarta.activation.DataSource ds) throws jakarta.mail.MessagingException
Only calls the corresponding constructor of the MimeMultipart
super class.
ds
- the DataSource from which to create the MimeMultipartjakarta.mail.MessagingException
- if an error occurs when creating the MimeMultipartpublic SMimeMultipart(java.lang.String subtype)
Only calls the corresponding constructor of the MimeMultipart
super class.
subtype
- the Mime subtypeprotected void updateHeaders() throws jakarta.mail.MessagingException
The SignedContent
class
must have access to this protected method. And that is the reason
for extending the jakarta.mail.internet.MimeMultipart
class.
updateHeaders
in class jakarta.mail.internet.MimeMultipart
jakarta.mail.MessagingException
- if an error occurs during the updating processpublic void addBodyPart(jakarta.mail.BodyPart part) throws jakarta.mail.MessagingException
addBodyPart
in class jakarta.mail.internet.MimeMultipart
part
- the body part to be addedjakarta.mail.MessagingException
- if an error occurs when adding the body part (e.g.
the supplied bodypart is no SMimeBodyPart
in the case of SMimePart control
is enabledpublic void addBodyPart(jakarta.mail.BodyPart part, int index) throws jakarta.mail.MessagingException
addBodyPart
in class jakarta.mail.internet.MimeMultipart
part
- the body part to be insertedindex
- the index where the body part shall be insertedjakarta.mail.MessagingException
- if an error occurs when adding the body part (e.g.
the supplied body part is no SMimeBodyPart
in the case of SMimePart control
is enabledpublic void checkForSMimeParts(boolean checkForSMimeParts)
adding
a bodypart to this multipart.
Especially when creating a signed message of type multipart/signed ("clear-signed")
care has to be taken to properly canonicalize -- in particular text -- messages to give
the same unique representation on the sender side where the signature is created and on the
recipient side where the signature is verified.
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 checking