users@jersey.java.net

Re: [Jersey] Changing jersey-multipart to not use JavaMail

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 17 Mar 2009 14:30:24 +0100

On Mar 16, 2009, at 3:07 PM, Craig McClanahan wrote:

> Paul Sandoz wrote:
>> Hi,
>>
>> When using jersey-multipart we are getting out of memory issues
>> because JavaMail buffers [1].
>>
>> I have been looking at the MIMEPull API [2]. It is a clean and
>> simple API that supports pull-based streaming of body parts (if
>> accessed in the serialized order) or buffering to disk.
>>
>> Craig has also proposed using Mime4J [3]. This API is a push-based
>> streaming API, e.g. like SAX where as MIMEPull is like StAX. The
>> last stable release of Mime4j is version 0.6
>>
>> From a quick look at both APIs i prefer the pull model of MIMEPull
>> rather than the push model of Mime4J. The former makes it much
>> easier to integrate into the existing code base.
>>
>> In addition to switching from JavaMail for parsing i propose that
>> while we do that work we implement support for @FormDataParam for
>> getting access to MIME body parts and deprecate the use of
>> @FormParam.
>>
> I agree with your preference and the suggested approach. Pull will
> definitely be easier to work with.
>

I have started work on this. Which has led to an "interesting" bug
with the Client API not pushing out the correct content type set by
the multipart writer (it looks like JavaMail is very forgiving when
parsing where as MIMEPull requires a boundary string).

Paul.