users@jersey.java.net

Re: Getting JSON data in client

From: Joachim Martin <jmartin_at_path-works.com>
Date: Thu, 14 Feb 2008 13:08:18 -0500

Is your client sending "Accept: application/json"?

--Joachim

Manveen Kaur wrote:
> 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net