users@jsr311.java.net

Re: Support for multipart MIME types in JAX-RS

From: Reto Bachmann-Gmür <reto_at_gmuer.ch>
Date: Tue, 09 Sep 2008 15:00:09 +0200

Paul Sandoz wrote:
>
>
> Marc Hadley wrote:
>> On Aug 14, 2008, at 6:58 PM, Craig McClanahan wrote:
>>
>>> I'm currently evaluating a proposed API that uses the multipart/mixed
>>> content type to allow metadata about an object (in XML or JSON) as
>>> one body subpart, and the object itself (typically in some binary
>>> format) as a second body part. I don't see anything in the current
>>> spec that would help me deal with this. Has there been any thinking
>>> about this, at either the spec or the RI level?
>>>
>> At the spec level we added the ability for a provider to locate other
>> providers via the Providers interface. It should be possible to write
>> a composite message body reader/writer using this.
>>
>> IIRC, Jersey supports use of JavaMail for working with multipart data
>> but I don't recall whether multipart/mixed is supported or
>> multipart/related or perhaps both.
>>
>
> It does it for multipart/form and reuses @FormParam, with the name
> corresponding to that in the content disposition of a body part. However
> it does not, yet, expose wrapper type to get access to other form
> meta-data.
It would be nice to have support for something like this in the spec.
Currently @FormParam seem to be bound to
application/x-www-form-urlencoded as it supports the Encoded annotation
and does not support arbitrary parameter-types so that a
MessageBodyReader could be used to parse the section of the multipart
message.

Reto