users@jersey.java.net

Re: [Jersey] Producing media type conflict

From: Cameron Heavon-Jones <cmhjones_at_gmail.com>
Date: Thu, 21 Oct 2010 13:17:56 +0100

Hi Paul,

I just upgraded from Jersey 1.0.1.

I understand the jax-rs spec doesn't include query parametre dispatching and probably for a good reason as i can see how it could get complicated.

From this simple case tho, it does seem intuitive to be able to dispatch based on the presence or absence of a declared query parametre for resolution.

Like i just posted to Imran, as the get() method is actually inherited and i can't get rid of it, i think i will just have to extract the query parametres from the uri manually in the overridden get().

I guess i just stumbled across one of those few 'fortunate' bugs, shame you closed it down :)

cam

On 21/10/2010, at 8:04 AM, Paul Sandoz wrote:

> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>