users@jersey.java.net

Getting JSON data in client

From: Manveen Kaur <Manveen.Kaur_at_Sun.COM>
Date: Thu, 14 Feb 2008 09:24:57 -0800

I'm using Jersey to develop my restful services and had a few questions.

Lets say I have an implementation of my service as below,

@UriTemplate("/myresource/")
public class MyResource {
    @HttpMethod
    @ProduceMime({"application/xml", "application/json"})
    public JAXBBean get() {
       JAXBBean j = ...
       return j;
    }
}

1. What do I need to do (which URI to invoke) in my client if I want to get
the result in JSON format.

2. If I just use the URI http://mydomain/myresource/, then xml would be returned by default.
How do I make JSON data to be returned as default?

Thanks
Manveen