users@jersey.java.net

Re: [Jersey] JSON Arrays

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 14 Aug 2008 10:48:04 +0200

Jakub Podlesak wrote:
> On Wed, Aug 13, 2008 at 05:00:26PM -0300, Julio Faerman wrote:
>> Do i really need a custom JAXBContextResolver to set the property:
>>
>> props.put(JSONJAXBContext.JSON_ROOT_UNWRAPPING, Boolean.FALSE);
>
> Yes.
>
>> is it possible to set this for all resources at once?
>
>
> Yes, you will just have a single JAXBContextResolver for all your
> JAXB beans.
>

BTW i think it would be useful to document what the default values are
for properties if relevant, or what it means if a property is absent,
and the Java types associated with the properties.

Also the namespace should be changed from:

       public static final String NAMESPACE = "com.sun.ws.rest.impl.json.";

to:

       public static final String NAMESPACE = "com.sun.jersey.api.json";

actually better to be:

       public static final String NAMESPACE = "com.sun.jersey.json";

because when we clean up the packages names (as a result of
modularization) the "api" name will go away.

Paul.

> ~Jakub
>>
>> On Tue, Aug 12, 2008 at 4:58 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>>> On Aug 11, 2008, at 7:43 PM, Lars Tackmann wrote:
>>>>>
>>>>> Thanks for your patience and for letting us know there is an issue!
>>>> No problem, this issue actually turned out to have a positive spin of,
>>>> since it forced my front end people to use my XML model directly which
>>>> they pointed out was overly complex.
>>>>
>>>> The problem is really that using the jersey client for testing JAXB
>>>> resources has become such a smooth experience that you completely
>>>> forget the complexity beneath. Quite a luxury problem and heads up to
>>>> you Sun people for creating this, I guess the old SOAP mantra of
>>>> writing your functional tests in another programming language also
>>>> holds true for RESTful services -
>>>>
>>> Yes, or other types of client APIs. Additionally it may be useful when
>>> documenting your service to include example responses in the formats that
>>> are supported. It is now possible to include the XSD associated with the
>>> JAXB beans and that will get referenced in the generated WADL but no
>>> everyone understands XSD :-) so providing examples as well is really useful.
>>>
>>>
>>>
>>>> Ohh well thats a good opportunity for writing my resource tests in
>>>> Ruby/rspec and running them in JRuby against a embedded Jetty server
>>>> (thus allowing me to get code coverage from a Ruby functional test).
>>>>
>>> If you want to avoid JAXB for testing representations on the client, but
>>> still want to use the Jersey client API could might be able to use JRuby,
>>> Groovy or Scala. But still i understand your point about the separation.
>>>
>>> What we don't have is tests of the Jersey client API that are separate from
>>> the JAX-RS/Jersey server side.
>>>
>>> Paul.
>>>
>>>> Thanks for helping me out with this.
>>>>
>>>> --
>>>> Yours sincerely
>>>>
>>>> Lars Tackmann
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109