users@jersey.java.net

[Jersey] Re: Jersey hangs when invalid JSON is sent in POST request

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Tue, 29 Mar 2011 13:47:28 -0700

Hi,

Just a clarification. The natural JSON notation in Jersey
still uses some internal code which depends on Jackson,
but it is not 100 % Jackson and still works via JAXB only.
I agree the configuration should be easier.

To fully switch to JSON Jackson support, which would
work also for a non-JAXB classes, and with simplified
configuration, you may want to set the JSON POJO mapping
feature as described at [1]. No JAXBContext resolver
would be then needed.

HTH,

~Jakub

[1]http://jersey.java.net/nonav/documentation/latest/json.html#d4e894



On 03/28/2011 11:49 AM, nbaliga wrote:
> I've had to switch over to using Jackson as the JSON processor by registering
> a custom JAXBContextResolver and using JSONConfiguration.natural().
>
> This wasn't documented too well, btw. It was only after looking at the
> source code was it clear that:
> natural = Jackson and mapped = internal JSON parser.
>
> As a result I have to also find all classes/representations that I want to
> have processed by this custom ContextResolver. Fortunately using Spring's
> ClassPathScanningCandidateComponentProvider made this process easy.
> Otherwise remembering to modify the ContextResolver after adding/deleting a
> representation would've been awkward and a deal breaker.
>
> I'm really surprised that:
> 1) a pretty basic test case such as sending incorrectly formed JSON causes
> Jersey to hang.
> 2) there's no easy way to switch over to using Jackson without having to go
> through the custom ContextResolver exercise.
>
> I think I'm missing something obvious here. Would be great if the community
> would comment on this issue. Any thoughts anyone?
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Jersey-hangs-when-invalid-JSON-is-sent-in-POST-request-tp6205397p6216287.html
> Sent from the Jersey mailing list archive at Nabble.com.
>