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:
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2010
(43)
-
▼
June
(8)
- XQDT: Notes for installing the current Milestone o...
- MarkLogic: XQuery: performance with Maps
- Java: Using Jersey with JAXB to output XML or JSON.
- MarkLogic: XQuery: hacking the position() - a basi...
- MarkLogic: XQuery: and / and-not query examples
- MarkLogic: XQuery: UNIX Timestamp to xs:dateTime C...
- MarkLogic: XCC/J: Passing a node() into a Query as...
- MarkLogic: XQuery: Typeswitching based on input "t...
-
▼
June
(8)
1 comment:
Thanks for the Sample, especially your curl example to call the service in JSON mode.
I completed an service that produces both XML and JSON, When invoking it was always giving XML as I was missing Accept: application/json
Post a Comment