Add convenience methods to set a message body and content-type at the same time
-------------------------------------------------------------------------------
Key: MIME4J-99
URL: https://issues.apache.org/jira/browse/MIME4J-99
Project: JAMES Mime4j
Issue Type: New Feature
Affects Versions: 0.5
Reporter: Markus Wiederkehr
Assignee: Markus Wiederkehr
Fix For: 0.6
Consider this code fragment to build a multipart message:
Header header = new Header();
header.addField(Field.parse("Content-Type",
"multipart/mixed;\r\n\tboundary=\""
+ MimeUtil.createUniqueBoundary() + "\""));
Multipart multipart = new Multipart("mixed");
Message message = new Message();
message.setHeader(header);
message.setBody(multipart);
Aside from the problem that the subtype "mixed" has to be specified twice this
is just overly long and error-prone. Instead a convenience method setMultipart
could be added to Entity that sets the message body and also sets the
content-type header field accordingly. The code fragment could be rewritten as:
Multipart multipart = new Multipart("mixed");
Message message = new Message();
message.setMultipart(multipart);
Similar convenience methods can be added for text/* and message/rfc822 bodies.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]