users@jersey.java.net

Re: [Jersey] XmlJavaTypeAdapter when using JSON

From: sarat.pediredla <sarat.pediredla_at_gmail.com>
Date: Wed, 10 Dec 2008 02:14:58 -0800 (PST)

Hi Paul,

Sorry I did not confirm. This is working now.

2008/12/10 Paul Sandoz (via Nabble) <ml-user+51078-1764451163_at_n2.nabble.com>:
> Hi Sarat,
>
> Just to confirm as i could not tell from your email: does it work for
> you now?
>
> Paul.
>
> On Dec 6, 2008, at 2:14 PM, sarat.pediredla wrote:
>
>>
>> Hi Jakub,
>>
>> Doh! Sorry about the typo. I did mean NOW.
>>
>
>>
>> Jakub Podlesak wrote:
>>>
>>> On Fri, Dec 05, 2008 at 02:06:38PM -0800, sarat.pediredla wrote:
>>>>
>>>> Sorry about this. I jumped the gun. The problem was more with how
>>>> I was
>>>> formatting the JSON as opposed to the XML.
>>>>
>>>> I am not using the Mapped configuration as follows for information.
>>>
>>> The "not" is confusing me a bit. Have you meant "now"?
>>> As based on the code, you *are* using the internal mapped
>>> configuration.
>>>
>>> So everything is ok?
>>>
>>> ~Jakub
>>>
>>>>
>>>> public JsonContextResolver() throws Exception {
>>>> Map props = new HashMap<String, Object>();
>>>> props.put(JSONJAXBContext.JSON_NOTATION,
>>>> JSONJAXBContext.JSONNotation.MAPPED);
>>>> props.put(JSONJAXBContext.JSON_ROOT_UNWRAPPING, Boolean.TRUE);
>>>> props.put(JSONJAXBContext.JSON_ARRAYS, new
>>>> HashSet<String>(1){{add("objects");}});
>>>> this.context = new JSONJAXBContext(types, props);
>>>> }
>>>>
>>>>
>>>> Paul Sandoz wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Did you verify if your DateAdapter is getting invoked or not when
>>>>> unmarshalling from JSON?
>>>>>
>>>>> What are the JSON configuration options you are using?
>>>>>
>>>>> The default JSON configuration uses a specific JSON XMLStreamReader
>>>>> implementation. It should not matter from JAXBs perspective in
>>>>> terms
>>>>> of applying the XmlAdapter but may be it is a character decoding
>>>>> issue... hard to say...
>>>>>
>>>>> If you are not using the default JSON configuration i would be
>>>>> curious
>>>>> to know if it works for you using say the mapped jettison
>>>>> configuration, which is using a different XMLStreamReader
>>>>> implementation.
>>>>>
>>>>> If you have time sending a simple reproducible example would be
>>>>> very
>>>>> helpful.
>>>>>
>>>>> Paul.
>>>>>
>>>>> On Dec 5, 2008, at 5:46 PM, sarat.pediredla wrote:
>>>>>
>>>>>>
>>>>>> I have a custom DateAdapter which extends XmlAdapter to convert
>>>>>> dates to and
>>>>>> from ISO 8601 date format to use Ruby-like timestamps when XML and
>>>>>> JSON is
>>>>>> rendered and read.
>>>>>>
>>>>>> It all seems to work fine when "reading" data and the ISO 8601
>>>>>> date
>>>>>> renders
>>>>>> fine in both XML and JSON modes. However, when "posting" a new
>>>>>> object, ISO
>>>>>> 8601 dates only seem to work in XML and not JSON.
>>>>>>
>>>>>> I was wondering if this is because of the XmlJavaTypeAdapter and
>>>>>> if
>>>>>> this is
>>>>>> not being triggered when unmarshalling JSON objects? Any views?
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>
>>>> http://n2.nabble.com/XmlJavaTypeAdapter-when-using-JSON-tp1619181p1619181.html
>>>>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>>>> For additional commands, e-mail: users-help@...
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>>> For additional commands, e-mail: users-help@...
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://n2.nabble.com/XmlJavaTypeAdapter-when-using-JSON-tp1619181p1620323.html
>>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/XmlJavaTypeAdapter-when-using-JSON-tp1619181p1622132.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>
> ________________________________
> This email is a reply to your post @
> http://n2.nabble.com/XmlJavaTypeAdapter-when-using-JSON-tp1619181p1638004.html
> You can reply by email or by visting the link above.
>
>

-- 
View this message in context: http://n2.nabble.com/XmlJavaTypeAdapter-when-using-JSON-tp1619181p1638096.html
Sent from the Jersey mailing list archive at Nabble.com.