users@jersey.java.net

[Jersey] Re: how can I get json and xml result

From: Andrzej Le¶kiewicz <andrzej.leskiewicz_at_gmail.com>
Date: Fri, 14 Jun 2013 13:20:07 +0200

You should use the Accept header in Your request.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html



2013/6/14 <everhow_at_163.com>

> I can defined method with @Produces annotations, but how can I get
> differenent result, eg, json and xml.
>
> @GET
> @Path("/registerUser")
> @Produces({ MediaType.APPLICATION_JSON,
> MediaType.APPLICATION_XML })
> public String registerUser(@QueryParam("deviceId") String
> deviceId){...}
>



-- 
Best regards
Andrzej Le¶kiewicz