RepresentationService
Configures the Restful Objects viewer to emit custom representations (rather than the standard representations defined in the RO spec).
The default implementations ultimately generate representations according to theRestful Objects specv1.0. It does this through a level of abstraction by delegating to implementations of the ContentNegotiationService SPI. This provides a mechanism for altering representations according to the HTTP Accept
header.
This interface is EXPERIMENTAL and may change in the future.
API
class RepresentationService {
RepresentationService(List<ContentNegotiationService> contentNegotiationServices)
Response objectRepresentation(IResourceContext resourceContext, ManagedObject objectAdapter) (1)
Response propertyDetails(IResourceContext resourceContext, ManagedProperty objectAndProperty) (2)
Response collectionDetails(IResourceContext resourceContext, ManagedCollection objectAndCollection) (3)
Response actionPrompt(IResourceContext resourceContext, ManagedAction objectAndAction) (4)
Response actionResult(IResourceContext resourceContext, ObjectAndActionInvocation objectAndActionInvocation) (5)
void assertContentNegotiationServiceHandled(Response.ResponseBuilder responseBuilder)
Response.ResponseBuilder buildResponse(Function<ContentNegotiationService, Response.ResponseBuilder> connegServiceBuildResponse) (6)
}
1 | objectRepresentation(IResourceContext, ManagedObject)
Returns a representation of a single object. |
2 | propertyDetails(IResourceContext, ManagedProperty)
Returns a representation of a single property of an object. |
3 | collectionDetails(IResourceContext, ManagedCollection)
Returns a representation of a single collection of an object. |
4 | actionPrompt(IResourceContext, ManagedAction)
Returns a representation of a single action (prompt) of an object. |
5 | actionResult(IResourceContext, ObjectAndActionInvocation)
Returns a representation of a single action invocation of an object. |
6 | buildResponse(Function)
Iterates over all #contentNegotiationServices injected ContentNegotiationService s to find one that returns a Response.ResponseBuilder using the provided function. |
Members
objectRepresentation(IResourceContext, ManagedObject)
Returns a representation of a single object.
By default this representation is as per section 14.4 of the RO spec, v1.0.
propertyDetails(IResourceContext, ManagedProperty)
Returns a representation of a single property of an object.
By default this representation is as per section 16.4 of the RO spec, v1.0.
collectionDetails(IResourceContext, ManagedCollection)
Returns a representation of a single collection of an object.
By default this representation is as per section 17.5 of the RO spec, v1.0.
actionPrompt(IResourceContext, ManagedAction)
Returns a representation of a single action (prompt) of an object.
By default this representation is as per section 18.2 of the RO spec, v1.0.
actionResult(IResourceContext, ObjectAndActionInvocation)
Returns a representation of a single action invocation of an object.
By default this representation is as per section 19.5 of the RO spec, v1.0.
buildResponse(Function)
Iterates over all #contentNegotiationServices injected ContentNegotiationService s to find one that returns a Response.ResponseBuilder using the provided function.
There will always be at least one such service, namely the ContentNegotiationServiceForRestfulObjectsV1_0 .