Discussion:
[errai-users] What is the JSON configuration to use with Jersey on the backend and Errai (2.2.0 or from git) ?
Ludovic Maitre
2013-03-07 21:21:32 UTC
Permalink
Hi all,

Thanks to Errai and his developers, i hope to have found in Errai the
best solution to develop java REST web services (JAX-RS, implemented
with Jersey and JAXB-RI on the server side) for GWT without to have to
develop separate RPC services for the GWT front-end (i would like to
have an UI agnostic solution for my webservices).

But i have a problem with the unmarshalling of lists from JAXB annotated
beans on the client side : i send a list of entities/beans ( like
List<Customers> ) from my Jersey/JAX-RS service, in JSON, and it didn't
work, the client side of the application trigger a NullPointerException
when trying to unmarshall my List of customers. It looks like the array
have not been well read by the underlying GWT JSON object (the value
member is null).

I had the same problem when sending only one entity ( like Customer )
from my webservice before i configure my custom JAXBContext on the
server side to use a JSONConfiguration.natural() for JSON requests (so
the numeric values were not enclosed by quotes (sending "id" : "30"
instead of "id" : 30 for a numeric member of an entity was broking the
JSON parser/unmarshaller on the GWT side). Actually, i have try to send
back a CustomerContainer bean with a List<Customer> member but it also
didn't work, for the same reason.

So i was wondering if any of the users of Errai had/know the best
configuration for the JSONConfiguration of Jersey to work with List of
beans* and would like to share it ? Does anybody succeed to interface
the 2 differents APIs ?

Sorry to bother you with this but i thought i should ask before spending
one more day on this ! :-) Thanks in advance for any answer,
Best regards,
Ludo

* ideally if it could works well with @XmlID and @XmlIDRef, it would be
really fine - i have now make the members like this @XmlTransient so
they didn't encumber the objects graph, but it still didn't work for
lists of basic objects without complex dependencies.

Loading...