users@jersey.java.net

[Jersey] Setting Request Content Type Dynamically

From: cgswtsu78 <cgray_at_proofpoint.com>
Date: Tue, 15 Dec 2009 14:34:38 -0800 (PST)

Hello,

Does anyone know how I can use a querystring parameter to set the content
type of the request.

For example if I have a resource method that accepts both XML and JSON, how
can I let the consumer (via a url GET request) decide what content type they
want to be returned? Is there an annotation I can use in order to map a
querystring request parameter to dynamically set the requests content type?


@GET
@Path("/topspamsenderchart")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Object getTest()
{

Object o = something.fetch;

return o;
}
-- 
View this message in context: http://n2.nabble.com/Setting-Request-Content-Type-Dynamically-tp4172634p4172634.html
Sent from the Jersey mailing list archive at Nabble.com.