dev@jsr311.java.net

Re: JSR311: Provider mime type matching

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 05 Sep 2008 13:00:28 -0400

On Sep 5, 2008, at 12:41 PM, Stephan Koops wrote:
>
> I think it's too late for the spec, but you could implement it out
> of the specification, as I also do. My JAXB provider supports
> @Produces( { "application/xml", "text/xml", "application/*+xml" })
> (and also @Consumes)
>
The spec (section 4.2.4) requires a standard entity provider for:

"javax.xml.bind.JAXBElement and application-supplied JAXB classes for
XML media types (text/xml, application/xml and application/*+xml)."

So if you have a method like this:

@POST
@Consumes("application/vnd.google-earth.kml+xml")
public SomeType someMethod(SomeJAXBBean bean) {...}

then the runtime-supplied JAXB message body reader should be used.
Same for producing.

Marc.

>
> Bill Burke schrieb:
>> I know this is probably too late but...
>>
>> A RESTEasy user brought up an interesting problem:
>>
>> They have JAXB annotated classes, but their incoming mime type is
>> "application/vnd.google-earth.kml+xml". They want to use the
>> provided JAXB Provider, but have to extend the vendor-specific
>> class and register it themselves.
>>
>> I guess it would be cool to allow:
>>
>> @Produces("application/{regex}+xml")
>>
>> or maybe regex's are overkill and something simple like:
>>
>> @Produces("application/+xml") will match everything *+xml. I don't
>> know :)
>>
>> Again, probably too late to get this in, but I'll log an issue
>> anyways.
>>
>> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: dev-help_at_jsr311.dev.java.net
>

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