Hi Gautam,
I doubt if your Provider class is being detected or not, are you able
to see some message like:
------------------------------------------------------------
INFO: Provider classes found:
class /yourContextResolver
-------------------------------------------------------------
/in the logs.
-Naresh
Gautam Arora wrote:
> Hi Naresh,
>
> I set rootUnwrapping to false, but still same output as before i.e. root
> element is dropped
>
> Let me know if you have any more ideas on what I could try, I'll try them in
> realtime (well, almost!) :)
>
> Thanks,
> Gautam
>
>
> Srinivas Naresh Bhimisetty wrote:
>
>> Hi Gautam,
>>
>> could you try setting rootUnwrapping to 'false' instead, i.e.,
>>
>> JAXBContext context = new
>> JSONJAXBContext(JSONConfiguration.mapped().rootUnwrapping(false).arrays("items").build(),type);
>>
>> Hope this helps,
>> Naresh
>>
>>
>>
>> Gautam Arora wrote:
>>
>>> update:
>>>
>>> 1. I moved to Jersey 1.0.2 (downloaded it and added to netbeans)
>>> 2. Edited the UriResolver.resolve() method
>>> original: JAXBContext context = JAXBContext.newInstance(type);
>>> modified: JAXBContext context = new
>>> JSONJAXBContext(JSONConfiguration.mapped().rootUnwrapping(true).arrays("items").build(),type);
>>>
>>> This was as per the steps given at
>>> http://blogs.sun.com/japod/entry/configuring_json_for_restful_web
>>>
>>> But the root element is still getting dropped. Any tips on how to make
>>> this
>>> work with this app?
>>>
>>> Gautam
>>>
>>>
>>> Gautam Arora wrote:
>>>
>>>
>>>> Hi,
>>>> I'm following the RESTful Pet Catalog tutorial from
>>>> http://weblogs.java.net/blog/caroljmcdonald/archive/2008/08/a_restful_pet_c_1.html
>>>>
>>>> The expected JSON response (as per the tutorial is)
>>>> http://localhost:8080/catalog/resources/items/
>>>>
>>>> {"items":{"@uri":"http://localhost:8080/catalog/resources/items","item":[{
>>>> etc etc
>>>>
>>>> but I get the response as:
>>>> {"@uri":"http://localhost:8080/catalog/resources/items","item":[{ etc
>>>> etc
>>>>
>>>> The "items" label is dropped.
>>>> I've read here on forum posts that say that dropping off the root
>>>> element
>>>> is a desired feature and with newer releases of jersey it should be
>>>> fixed(/configurable?)
>>>>
>>>> I've developed the app myself and also tested the same app by
>>>> downloading
>>>> it and running it and and running into the same issue.
>>>>
>>>> I'm using Jersey 1.0. Is this issue fixed in 1.0.2?
>>>>
>>>> Whats the best way to make jersey1.0 generate the "items" label for this
>>>> app? I've read on posts that we need to add a property for the json
>>>> unwrapping but cant figure out where/how to put it in the pet catalog
>>>> sample app.
>>>>
>>>> I need this as I'm using YUI which expects this and throws an invalid
>>>> label error otherwise
>>>> As per the tutorial, having the label is the expected behavior, so any
>>>> reasons why I could be missing it?
>>>>
>>>> Thanks,
>>>> Gautam
>>>>
>>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>>
>
>