I have some code that works, but I am looking for a better way to do it. I have a RESTful web API that I want to support JSON, XML, and TEXT media types. The JSON and XML
Implementing a MessageBodyReader
/Writer
would be what you need to do in order to do the following:
@GET @Path("details/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
public List details() {
return manager.details();
}
It's not very much code to write, and if you are able to write it generic enough you will be able to get some re-use out of it.