I am following the jersey tutorial here to figure out how one would produce multiple mime outputs. From their website, this is the recommended way:
@GET
@Produces({"application/xml", "application/json"})
public String doGetAsXmlOrJson() {
...
}
What I cannot figure out is how to abstract the @Produces away, so that my code is more welcoming to additional mime types it can produce. Say for example I have 500 methods that all have this annotation:
@Produces({"application/xml", "application/json"})
If I get a requirement to add kml as a mime type, editing and replacing all of those values would certainly be time consuming.
@Produces({"application/xml", "application/json", "application/kml"})
Is it possible to architect @Produces more efficiently so that I do not have this issue down the road?