users@jersey.java.net

[Jersey] how to use Application/Json in JResponse

From: Brendan cheng <ccp999_at_hotmail.com>
Date: Thu, 7 Jun 2012 07:44:13 +0000

Hi,
my following function in Resource file can produce result correctly in xml but not JSON.
        @GET
        @Path("/{id}/companies")
        @Produces({ "application/xml", "application/json" })
        public JResponse<List<hk.itags.restclient.Company>> getCompanies(
                        @PathParam(value = "id") long id) {
               List<hk.itags.restclient.Company> comlist = null;        ....        return JResponse.ok(comlist).build();        }
I thought JAXB can produce both xml and json output.  what is the problem?
Regards,
Brendan