james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Wiederkehr" <markus.wiederk...@gmail.com>
Subject MIME4J - remove parent reference from Body?
Date Mon, 29 Sep 2008 16:10:21 GMT
Before I file another MIME4J issue I would like to ask your opinion.

At the moment we use Sun's JavaMail API to process and manipulate e-mails. I
would like to go away from JavaMail so I am currently evaluating MIME4J to
see if is an alternative. So far it looks very promising.

Our use case is typically the following: parse an incoming message; run the
message through a workflow that manipulates it (can be: apply a signature,
add/remove/replace an attachment, etc.); re-send and/or archive the message.

Now the problem is that I would basically like to create a new Message
object that should contain some parts from the original message and some new
parts. The original message should not modified though. In other words I
would like to create a Message that shares some Part objects with another

Currently this is not possible because Part holds a reference to a parent
Entity (getParent() and setParent()) and a Part can of course have only one

So the question is do you think it would be possible to remove this parent

In the current release the parent entity is used for two purposes:
1) determine the message boundary and charset in Multipart.writeTo()
2) in Entity.getMimeType() to ask the parent if the entity does not have a
Content-Type header field.

Number one could be resolved by adding an "Entity parent" parameter to
Body.writeTo(). But I am not sure about number two. Would it suffice to
return null instead of delegating to a parent entity?

I have attached a patch for #1 to illustrate what I mean. Hope it gets
through the mailing list..


View raw message