users@jsr311.java.net

Re: Using "*" as a wildcard when searching for the Provider using the javax.ws.rs.ext.Providers interface

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 10 Jul 2009 09:22:16 -0400

Its doesn't say explicitly but the intent is that matching works as if
MediaType.isCompatible method was used. This method supports wildcards
and is commutative.

Marc.

On Jul 10, 2009, at 2:18 AM, Michael Elman wrote:

> Hi,
>
> I'm somewhat confused how "*" in the Media Type value should be
> treated, when using the javax.ws.rs.ext.Providers interface to get
> the providers (MessageBodyReaders/Writers and ContextResolvers)
> I mean should it be treated as a wildcard or as string?
>
> For example if I have the following providers:
>
> @Produces("text/plain")
> class ProviderA implements MessageBodyWriter
>
> @Produces("text/*")
> class ProviderB implements MessageBodyWriter
>
> @Produces("text/xml")
> class ProviderC implements MessageBodyWriter
>
> If "*" is treated as a string, only ProviderB is matching.
> If "*" is treated as a wildcard, all three providers are matching.
>
> So what is correct?
>
> Thanks,
> Michael.