jsonapi-converter icon indicating copy to clipboard operation
jsonapi-converter copied to clipboard

JAX-RS Compatibility

Open kotak25krishna opened this issue 9 years ago • 4 comments

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.

kotak25krishna avatar Jul 07 '16 14:07 kotak25krishna

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.

jasminb avatar Jul 07 '16 14:07 jasminb

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 avatar Oct 13 '16 08:10 pawelradeckihomify

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

pawelradeckihomify avatar Oct 13 '16 16:10 pawelradeckihomify

@pawelradeckihomify So, how did you do it ?

Magador avatar Nov 25 '16 16:11 Magador