The approach that works is:
- Build with the jersey-media-moxy module – so
- Put the jaxb.properties file in the right place – so
- Create a mapping file – so
- Create a ContextResolver – example. This will be used for JSON but not for XML.
- Create a MessageBodyWriter – example. This will be used for XML.
- Most importantly, write and let me know where on earth I went wrong to need to jump through all these hoops 🙂
Check out this little demo project to see how it all fits together.