users@glassfish.java.net

JavaMail and streaming

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 12 Mar 2009 09:20:39 +0100

Hi,

Jersey utilizes JavaMail for parsing "multipart/*" messages, but we
are encountering out of memory issues for large body parts [1].

Are there conditions under which JavaMail will not buffer if body
parts, e.g. if the parts are accessed in serialization order. I want
to understand what is possible before deciding to switch to something
else.

It may be we need to switch to a streaming based parser. Two APIs come
to mind:

1) MIME pull, which is used by Metro
      https://mimepull.dev.java.net/

2) Mime4j
     http://james.apache.org/mime4j/

Paul.

[1] https://jersey.dev.java.net/issues/show_bug.cgi?id=238