Hi, Paul!
I am uisng ExtJS as UI and I want to display generated json in ExtJS
grid which expect some property containg total records for pagination
purpose.
-Sanjay
-----Original Message-----
From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Wednesday, April 22, 2009 3:48 AM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] How to append extra informaion to generated json
Hi Sanjay,
Just curious as to why you want to do this when it can be derived from
the JSON data structures using JavaScript?
Having additional information like this also introduces the possibility
for errors if the total number of objects is declared is different to
the number of objects.
The easiest way to support this is for it to work for XML and JSON.
It may be possible to set the JAXB field for the total objects only when
JSON is the most acceptable. You can do this by calling the
HttpHeaders.getAcceptableMediaTypes() and checking if the first media
type is JSON related or XML related.
Another alternative is to not support XML if you do not need to. You can
still use JAXB of course.
Paul.
On Apr 21, 2009, at 8:37 PM, Patel, Sanjay wrote:
> Hey,
>
> I am using jersey/jaxb to convert my list of objects to JSON. I want
> to add extra property to my generated JSON (e.g "total":
> total_objects_in_list). How can I do that??
>
> Sanjay
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net