users@jersey.java.net

_at_GET _at_ConsumeMime - converter parameter

From: Lee, Deirdre <Deirdre.Lee_at_deri.org>
Date: Fri, 5 Sep 2008 10:23:00 +0100

Hi,

I'm new to JAX-RS and have a question regarding @GET parameters. Looking
at examples, I see this is the typical way to construct a resource
class:

 

@Path("/customers/")

public class CustomersResource {

@Context

private UriInfo context;

 

@GET

@ProduceMime({"application/xml", "application/json"})

public CustomersConverter get(

@QueryParam("start") @DefaultValue("0") int start,

@QueryParam("max") @DefaultValue("10") int max) {

......

}

 

@POST

@ConsumeMime({"application/xml", "application/json"})

public Response post(CustomerConverter data) {

....

}

}

 

However, I was wondering if it was possible to do the following:

@GET

@ConsumeMime({"application/xml", "application/json"})

public Response post(CustomerConverter data) {

....

}

i.e. pass a converter class as a parameter to a GET function. I've
tried, but this has resulted in errors, so I was wondering if anyone
could explain why this isn't possible.

 

Thanks,

D