Re: JSR311: Issue 43: javax.activation support

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 20 Jun 2008 09:36:31 -0400

On Jun 19, 2008, at 4:10 AM, Stephan Koops wrote:
> I'm not familiar with the JAF. When should your example be used? As
> a new entity proider, which could generate every class?
How its implemented is up to you. The spec would require that
implementations first look for a MessageBody[Reader|Writer], then, if
none is found, look for a JAF DataContentHandler. Seems like a new
entity provider would be a good way to implement it as long as that
one was always used as a last resort.


> 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.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Marc Hadley <marc.hadley at>
CTO Office, Sun Microsystems.