users@jersey.java.net

Re: [Jersey] Proper way to read/write customized java types?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 19 Feb 2009 11:29:49 +0100

On Feb 18, 2009, at 9:05 PM, Will Hoover wrote:

> Does http://rext.googlecode.com/files/rest-src.rar look reasonable?
>

It does.

I am not exactly sure what JSONObject is, but it looks very similar to
the JSONObject provided by Jettison. Is that the case?

Note that we have support for Jettison's JSONObject. See the JSON
section of:

   https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/jersey/dependencies.html

Paul.



> -----Original Message-----
> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> Sent: Wednesday, February 18, 2009 12:12 PM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] Proper way to read/write customized java types?
>
>
> On Feb 18, 2009, at 6:08 PM, Will Hoover wrote:
>
>> Thanks for the input :o)
>>
>> Can you give be an example as a starting point?
>>
>
> See the sample:
>
>
> http://download.java.net/maven/2/com/sun/jersey/samples/entity-provider/1.0
> .
> 2/entity-provider-1.0.2-project.zip
>
> for defining you own entity providers.
>
> Paul.
>
>> -----Original Message-----
>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>> Sent: Wednesday, February 18, 2009 11:46 AM
>> To: users_at_jersey.dev.java.net
>> Subject: Re: [Jersey] Proper way to read/write customized java types?
>>
>>
>> On Feb 18, 2009, at 5:28 PM, Will Hoover wrote:
>>
>>> Well a start might be: http://xstream.codehaus.org/json-
>>> tutorial.html seeing jettison is already being used internally to
>>> Jersey?
>>>
>>
>> IMHO I do not think using the Jettison mapped convention is the right
>> approach. We need a better convention that avoids some of the
>> artifacts when going to and from XML infoset and JSON as we have been
>> discussing in another thread. The JAXB "natural" approach attempts to
>> reduce those artifacts, but only when using JAXB objects.
>>
>> The JsonHierarchicalStreamDriver looks more interesting but can only
>> be used for serialization.
>>
>> Note that it is possible to experiment by writing your own message
>> body readers/writers. You can override the current JSON support using
>> the media type "application/json" if you wish.
>>
>> Paul.
>>
>>> -----Original Message-----
>>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>>> Sent: Wednesday, February 18, 2009 10:55 AM
>>> To: users_at_jersey.dev.java.net
>>> Subject: Re: [Jersey] Proper way to read/write customized java
>>> types?
>>>
>>> On Feb 18, 2009, at 3:34 PM, Will Hoover wrote:
>>>
>>>> I'm sorry for not being clear... I was referring to if there will
>>>> be
>>>> support for POJOs to Java in the future.
>>>>
>>>
>>> There are currently no concrete plans. I would like to consider it,
>>> but i am not sure what technology would be best. Could you log an
>>> issue so we can track this?
>>>
>>> To me Jackson would be the first choice to look at. I am open to
>>> suggestions. Jakub? Tatu? any ideas?
>>>
>>> Paul.
>>>
>>>> -----Original Message-----
>>>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>>>> Sent: Wednesday, February 18, 2009 9:22 AM
>>>> To: users_at_jersey.dev.java.net
>>>> Subject: Re: [Jersey] Proper way to read/write customized java
>>>> types?
>>>>
>>>>
>>>> On Feb 18, 2009, at 3:09 PM, Will Hoover wrote:
>>>>
>>>>> Thanks Paul...
>>>>>
>>>>> Is there going to be support for this in the future?
>>>>>
>>>>
>>>> If you mean will it continue to be in future releases of Jersey,
>>>> yes
>>>> it will. It will be maintained and not removed.
>>>>
>>>> Once a feature goes into a stable release of Jersey it is
>>>> maintained
>>>> going forward and we strive to retain backwards compatibility
>>>> between releases.
>>>>
>>>> For the JSON conventions backwards compatibility is very
>>>> important.
>>>>
>>>> Paul.
>>>>
>>>>> -----Original Message-----
>>>>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>>>>> Sent: Wednesday, February 18, 2009 9:00 AM
>>>>> To: users_at_jersey.dev.java.net
>>>>> Subject: Re: [Jersey] Proper way to read/write customized java
>>>>> types?
>>>>>
>>>>> Hi Will,
>>>>>
>>>>> Currently the only way we support POJOs to JSON and back is in
>>>>> conjunction with JAXB.
>>>>>
>>>>> See Jakub's blog entry:
>>>>>
>>>>> http://blogs.sun.com/japod/entry/configuring_json_for_restful_web
>>>>>
>>>>> See the sample here:
>>>>>
>>>>>
>>>>> http://download.java.net/maven/2/com/sun/jersey/samples/json-from-
>>>>> jaxb
>>>>> /1.0.2
>>>>> /json-from-jaxb-1.0.2-project.zip
>>>>>
>>>>> Note that for the JAXB "natural" convention to work you need to
>>>>> use
>>>>> JAXB 2.1.10.
>>>>>
>>>>> Paul.
>>>>>
>>>>> On Feb 18, 2009, at 2:43 PM, Will Hoover wrote:
>>>>>
>>>>>> What is the "proper" way to convert POJOs to JSON and back
>>>>>> (1.0.2)?
>>>>>> I seen
>>>>>> that TODO for "Supporting the Reading and Writing of Customized
>>>>>> Java Types"
>>>>>> (http://wikis.sun.com/display/Jersey/Advanced+JAX-RS
>>>>>> +1.0+Features)
>>>>>> and
>>>>>> http://blog.refinn.com/category/jersey/ regarding the use of
>>>>>> jackson.
>>>>>> Is there an example of how to use this in Jersey?
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------
>>>>>> --
>>>>>> - 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 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 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 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
>