Using Moxy with Jersey for XML Part 2

In part 1 I described the ways in which the documented approach doesn’t work. This post is about my first workaround, but for a comprehensive debrief, see part 3.

The approach that works is:

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

Leave a Reply

Your email address will not be published. Required fields are marked *