Thinking about it some more, if we applied the same approach for
Response as I just suggested for Representation in the "Mapping
POJOs" thread it might help with this thread too.
To sketch it out a little more:
- the API defines a set of fine grained annotations for metadata
(media-type, location, content location, language etc)
- an @HttpMethod/_at_Method/_at_WebMethod annotated method could return any
type of object or primitive type
- method or resource-class level annotations would provide metadata
default values
- annotated properties of the returned object would provide metadata
and override defaults specified at the method or resource class level
- the API would provide a set of generic representation and response
classes that use the fine-grained annotations for common scenarios
like issuing a redirect.
E.g. the current TemporaryRedirect class would become something like:
public class TemporaryRedirect extends HttpResponse {
...
@RepresentationLocation
public URI getLocation() {...}
}
But any user-defined class could also set the location header using
the annotation, the TemporaryRedirect class would be a convenience
class for those that don't want to define their own (the majority I
suspect).
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.
- application/pkcs7-signature attachment: smime.p7s