james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Wiederkehr (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] Closed: (MIME4J-99) Add convenience methods to set a message body and content-type at the same time
Date Tue, 27 Jan 2009 16:00:59 GMT

     [ 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.


Mime
View raw message