When a resource URI has been embedded in a RepresentationModel
, the framework message body writer invokes the URI to get the resource representation to embed. Note that an embedded resource will only appear in the response if the payloadSchema.xml
includes an embedded
tag for the embedded relation name. The use-validator-id
attribute of the embedded
tag identifies the validator to use for the embedded resource.
Embedded collection resources members can be added to the RepresentationModel
by calling the members
method and passing the array of string URIs or the links that contain the self
link to each individual member of the collection.
When retrieving embedded resources, if the client request does not specify that an Etag should be generated by using the generateEtags
query parameter, the framework will set the parameter to false
so that Etags will not be generated. For additional information, refer to the Working with Client-Side Caching section.
To embed a resource, add the URI of the resource to the model. You can find the URI of the resource by using the LinkUtils
class. To obtain an instance of LinkUtils
, use the static LinkUtils.getLinkUtils()
method, or resolve the global Nucleus component.
The LinkUtils
class contains the following methods that can be used to find the resource’s URI:
Method | Description |
---|---|
| Provides support for generating a URI for any resource for a given resource ID. |
| Provides support for generating member URIs for collection resources. |
| Provides a way to generate a |