dev@jsr311.java.net

Re: JSR311: Issue 43: javax.activation support

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Thu, 19 Jun 2008 10:10:30 +0200

Hi,

I'm not familiar with the JAF. When should your example be used? As a
new entity proider, which could generate every class?

best regards
   Stephan

Marc Hadley schrieb:
> Issue 43[1] resulted from some internal feedback that it would be
> useful to be able to use existing java activation framework (JAF)
> DataContentHandlers with JAX-RS rather than force people to rewrite
> them as MessageBodyReaders and Writers.
>
> For example, given a resource method:
>
> @POST
> Foo getFoo(Bar bar) {...}
>
> An implementation could make use of an existing handler to deserialize
> the request along the following lines.
>
> DataHandler dh = new DataHandler(dataSource);
> DataFlavor df[] = dh.getTransferDataFlavors();
> DataFlavor barDataFlavor = findMatchingFlavor(Bar.class, df);
> Bar = (Bar)dh.getTransferData(barDataFlavor);
>
> JAF isn't as flexible as JAX-RS entity providers (there's no access to
> annotations, generic type, other headers etc) so I think it should be
> supported as a fallback when a suitable MessageBodyReader or Writer
> can't be found.
>
> Thoughts, comments ?
> Marc.