public class SMimeMultipart
extends javax.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(javax.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(javax.mail.BodyPart part)
Adds a body part.
|
void |
addBodyPart(javax.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, parse, setSubType, writeTopublic SMimeMultipart()
public SMimeMultipart(javax.activation.DataSource ds)
throws javax.mail.MessagingException
Only calls the corresponding constructor of the MimeMultipart
super class.
ds - the DataSource from which to create the MimeMultipartjavax.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 javax.mail.MessagingException
The SignedContent class
must have access to this protected method. And that is the reason
for extending the javax.mail.internet.MimeMultipart
class.
updateHeaders in class javax.mail.internet.MimeMultipartjavax.mail.MessagingException - if an error occurs during the updating processpublic void addBodyPart(javax.mail.BodyPart part)
throws javax.mail.MessagingException
addBodyPart in class javax.mail.Multipartpart - the body part to be addedjavax.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(javax.mail.BodyPart part,
int index)
throws javax.mail.MessagingException
addBodyPart in class javax.mail.Multipartpart - the body part to be insertedindex - the index where the body part shall be insertedjavax.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