james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wiederkehr <markus.wiederk...@gmail.com>
Subject Re: MessageBuilder refactoring; was Re: dom / message refactoring
Date Tue, 25 Jan 2011 23:15:01 GMT
On Tue, Jan 25, 2011 at 10:09 PM, Stefano Bagnara <apache@bago.org> wrote:
> 2011/1/25 Oleg Kalnichevski <olegk@apache.org>:
>> On Tue, 2011-01-25 at 17:49 +0100, Stefano Bagnara wrote:
>>> 2011/1/25 Oleg Kalnichevski <olegk@apache.org>:
>>> > * MessageBuilder redesigned and changed to an interface
>>> > * Moved #writeTo method to MessageWriter interface
>>> Moving "writeTo" from each "DOM node" to a MessageWriter interface
>>> have the drawback that you cannot anymore serialize just part of a
>>> message (just a subtree, an header, a content) because your
>>> MessageWriter serializes only full messages. On the other side I see
>>> the advantage of having the writer separated from the element itself
>>> (reading and writing are different tasks).
>> I am sorry but that was not done by me.
>> http://svn.apache.org/viewvc?view=revision&revision=739822
> So it seems the "feature" has been removed long ago! Thanks for the link.

It is still possible to serialize parts of a Message because
MessageWriter (MimeWriter in Oleg's branch) publicly exposes the
methods to do so (writeMultipart(), etc).

See http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/main/java/org/apache/james/mime4j/message/MessageWriter.java?view=markup

IIRC the reason for that change was that there were different
strategies for writing messages (strict, lenient) and before the
change the code for writing and these strategies in particular was
scattered around the various message classes (Header, Entity,
Multipart, ..). Now it's all in one place. See also MIME4J-110..

Later, in the course of MIME4J-118, the different writing modes were
removed and now there is only one MessageWriter instance called


View raw message