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

RepresentationService.java
class RepresentationService {
  RepresentationService(List<ContentNegotiationService> contentNegotiationServices)
  ResponseEntity<Object> objectRepresentation(IResourceContext resourceContext, ManagedObject objectAdapter)     (1)
  ResponseEntity<Object> propertyDetails(IResourceContext resourceContext, ManagedProperty objectAndProperty)     (2)
  ResponseEntity<Object> collectionDetails(IResourceContext resourceContext, ManagedCollection objectAndCollection)     (3)
  ResponseEntity<Object> actionPrompt(IResourceContext resourceContext, ManagedAction objectAndAction)     (4)
  ResponseEntity<Object> actionResult(IResourceContext resourceContext, ObjectAndActionInvocation objectAndActionInvocation)     (5)
  ResponseEntity<T> assertContentNegotiationServiceHandled(ResponseEntity<T> responseBuilder)
  ResponseEntity<Object> buildResponse(Function<ContentNegotiationService, ResponseEntity<Object>> 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.

propertyDetails(IResourceContext, ManagedProperty)

Returns a representation of a single property of an object.

collectionDetails(IResourceContext, ManagedCollection)

Returns a representation of a single collection of an object.

actionPrompt(IResourceContext, ManagedAction)

Returns a representation of a single action (prompt) of an object.

actionResult(IResourceContext, ObjectAndActionInvocation)

Returns a representation of a single action invocation of an object.

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 .