jasminb / jsonapi-converter

JSONAPI-Converter is a Java/Android library that provides support for working with JSONAPI spec
Apache License 2.0
273 stars 81 forks source link

JAX-RS Compatibility #51

Open kotak25krishna opened 8 years ago

kotak25krishna commented 8 years ago

Does Json api supports JAX-RS message readers and writers. I am trying to convert raw response to Rest resources for a JAX-RS compliant restful resource. Below are the success and failure scenarios.

Success Scenario :- ResourceConverter converter = new ResourceConverter(User.class); User.class will be read dynamically from JAX-RS MessageBodyReader and I am able to conver raw response to java resource

Failure Scenarion : ResourceConverter converter = new ResourceConverter(User.class,Status.class); Through jax-rs messagebodyreader it is difficult to read multiple object types (which are related each other).

Hence trying to understand json api converter is compatible with jax-rs based frameworks.

jasminb commented 8 years ago

Hey,

Library was not written with JAX-RS in mind, however, you should be able to implement MessageBodyReader<T> so you can handle multiple types correctly, eg. resolve target type dynamically and than invoke resource converter.

pawelradeckihomify commented 7 years ago

Hi there,

And what about serializing objects with json-converter and exposing them with JAX-RS? Any hint how to do it would be more than welcome.

pawelradeckihomify commented 7 years ago

Got it working with MessageBodyWriter. So far it works! Thanks for a good library.

Magador commented 7 years ago

@pawelradeckihomify So, how did you do it ?