users@glassfish.java.net

Re: JavaMail and streaming

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Tue, 17 Mar 2009 09:13:06 -0700

Hi Paul,

There isn't currently anyway for JavaMail's multipart support to do what
you ask. It isn't designed to support arbitrarily large streams.

The Metro support you mention is seems much more suited for the task
(large uploads/downloads) you are supporting.

-Peter

Paul Sandoz wrote:
> 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