Monday, 21 June 2010

Java: Using Jersey with JAXB to output XML or JSON.

A very brief (and simple) example of the principle behind harnessing Jersey's content negotiation ability whilst taking advantage of JAXB to marshall a bean from a Java Object to XML/JSON:



And the resource:


Testing the resource(s) using curl:

Which would yield:

or:

Which would yield:

0 comments:

Blog Archive