I know we discussed this before, but, another thing
MessageReader/Writer's need is access to the GenericType of the thing
being (un)marshalled.
Bill Burke wrote:
> I don't know if jax-rs plans to add support for multipart (form-data,
> mixed, etc...) (I wish we would figure out an abstraction), but
> currently I don't see a way of supporting it portably in the current model.
>
> The main reason is that there is no way of looking up providers by
> mediaType and class. There used to be a createMessageBodyReader/Writer.
> I wish we could bring that back. That way, a mulitpart @Provider could
> look up and call marshalling based on this. i.e.
>
> public interface MultipartMixed {
>
> public void writeObject(MediaType type, Object obj);
> }
>
> or
>
> @ProduceMime("multipart/mixed")
> List<String> get() { ... }
>
> @Provider will have a match based on multipart, Collection as a type. It
> iterates through the collection and finds a MessageBodyReader or
> Writer. Creates its own header/outputstream objects, calls the
> reader/writer, returns.
>
> or
>
> @ProduceMime("multipart/form-data")
> MyForm
> get()
>
>
>
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com