You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by "Markus Wiederkehr (JIRA)" <mi...@james.apache.org> on 2009/01/27 17:00:59 UTC
[jira] Closed: (MIME4J-99) Add convenience methods to set a message
body and content-type at the same time
[ https://issues.apache.org/jira/browse/MIME4J-99?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Markus Wiederkehr closed MIME4J-99.
-----------------------------------
Resolution: Fixed
> 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.