How can I provide multiple representations for a resource in an optimal way?
I have a database-backed application that stores an address book. I wish the data to be exposed as both a JsonRepresentation and a DomRepresentation. Currently, I am creating both representations as part of the getVariants() call so that content negotiation can take place. However, to do this I need to construct both a DOM Document and a JSONObject in order to create the respective representations even when the client is only asking for 1 of these representations. Wouldn't it be better if the Resource could expose out what possible MediaTypes it supported and then the handler just ask for the representation the client requested? Thanks. Sumit

