users@jersey.java.net

Re: [Jersey] Multipart 1.0.3 not finding message body reader

From: Ari Heino <ext.ari.heino_at_tieto.com>
Date: Wed, 3 Jun 2009 23:42:39 -0700 (PDT)

Paul Sandoz wrote:
>
>
> On Jun 2, 2009, at 11:44 PM, Ari Heino wrote:
>
>>
>>
>>
>> Paul Sandoz wrote:
>>>
>>>
>>> If you want to stream the body part (which will be cached to disk)
>>> you
>>> need to do:
>>>
>>> InputStream in =
>>> multiPart.getBodyParts().get(1).getEntityAs(InputStream.class);
>>>
>>>
>>
>> So if i pass on this Stream to other components, does it actually
>> contain
>> anything?
>
> Yes, one can read the bytes of the MIME body.
>
>
>> Like you said, MimePull needs to be "used" inside Jersey resource
>> class, otherwise stream.available() == 0.
>
> Correct, one should not use that to assume that the stream is empty.
>
>
>> So that means that the stream
>> needs to be read into memory while process/thread is still in jersey
>> resource, right? Or is the content available elsewhere also, since
>> it is
>> cached to disk?
>
> The latter, MimePull will automatically cache all the attachments to
> disk. It is possible to configure the size at which caching is
> performed.
>
> Paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>

I ment is the stream available outside jersey resource class? F.e. if I pass
the multipart stream object forward to some/any other class and let it deal
with the stream. Would the stream still contain the actual content (or be
"pulled in" with MimePull) even if the stream is only accessed outside
Jersey code?

My aim here is that do I need to read the stream content into byte array
inside Jersey resource (therefore using memory also) to be able to use the
stream content anywhere else in my code? Or is it possible to just pass the
stream without reading it's content into memory?

-- 
View this message in context: http://n2.nabble.com/Multipart-1.0.3-not-finding-message-body-reader-tp2668407p3023133.html
Sent from the Jersey mailing list archive at Nabble.com.