users@jersey.java.net

Re: [Jersey] Producing media type conflict

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 21 Oct 2010 09:04:05 +0200

Hi Cam,

What version did you upgrade from?

On Oct 20, 2010, at 10:15 PM, Cameron Heavon-Jones wrote:

> Hi,
>
> I've just upgraded to jersey 1.4 and i have some code which used to
> work now failing with the message that there is a conflict in the
> produced media type. The two methods differ in that one has a query
> term and the other doesn't, eg:
>
>
> @GET
> @Override
> public Response get() {
> return get("");
> }
>
> @GET
> @QueryParam("term")

JAX-RS only dispatches based on the URI path with @Path, media types
with @Produces/_at_Consumes and the HTTP method. It does not dispatch
based on one or more query parameters. So the behavior you expect
would of never worked in the first place.

I think you were using an early version of Jersey that did not detect
conflicting resource methods for the same HTTP method that consume
and/or produce the same media types.

Paul.

> public Response get(@QueryParam("term") String term) {
> return Response.ok().build();
> }
>
>
> I saw on a previous post[1] that this was related to subclassing but
> in my case both methods are in the same class and with a
> differentiator.
>
> Thanks,
> Cam
>
> [1]http://markmail.org/search/?q=list%3Anet.java.dev.jersey.users#query
> :list%3Anet.java.dev.jersey.users+page:1+mid:7tmzxnm6dsqh6iov+state:results
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>