Hey guys! How’s it going?
Let’s write custom entity providers to process any document formats we like with JAX-RS – without sacrifying SoC!
Today’s episode of “JAX-RS Done Right!” keeps Separation of Concerns while adding support for ANY document type – even your own fancy one! So the application only has PURE domain code when it comes to handling http bodies, while the dealing with the new data type happens in separate classes. The key for this are CUSTOM Entity Providers (i. e. renderers and parsers for a combination of Java class and media type OTHER than plain text, json or xml). This is much easier as you might expect, makes you application very flexible, but still keeps the domain logic PERFECTLY READABLE even when you add MANY data types!
This builds upon an early episode, in which we learned what Entity Providers are in general, and Default Entity Providers for plain text, json and xml in particular.
Code example can be found on Gitlab: https://gitlab.com/mkarg/jaxrs-done-right
Stay safe and… Party on!