There are tons of examples on how to include Hypermedia links using JAXB and HATEOAS, but I cannot find any for Hypermedia + JSON. I like JAXB because just using annotations you can map the XML to the Object. Include HATEOAS and this is almost what I need, except its only in XML (because of JAXB of course). The problem is JAXB providers do not support JSON, as per 2.0 user guide.
So, using the example above, what I'm looking for is instead of this XML+Hypermedia output
<user-management>
<users>/user-management/users</users>
<report>/user-management/report</report>
</user-management>
Instead to get this JSON+Hypermedia output
{
"_links": {
"self": { "href": "/user-management" },
"users": { "href": "/user-management/users" },
"report": { "href": "/user-management/report" },
}
}
*Yes, both examples are representations of the Resource, but examples of the Object/Model should be similar therefore I'm not including them.
Could it simply be that there's no framework to do this today since this JSON+Hypermedia specification has not be standardized? The most I found was a proposal, and a "To be continued..."
I am aware that I could created my own JAX-RS provider using MessageBodyWriter, but this only helps in marshalling "application/json" requests to the Object. I still need a way to get the Hypermedia links.
The reason I'm searching for this is because my current requirement is to return JSON data that includes Hypermedia links.
Does anyone have full working example? I cannot find any, and I vaguely recall seeing an article stating that I would need to "roll your own". Not desirable, but if that's what it will take...