The CacheWriterInterceptor invokes the JSONMessageBodyWriter, OracleJSONMessageBodyWriter or HALMessageBodyWriter by matching the Accept header media-type specified by the client. Responses that are not resource representations or error responses are output using the JSONMessageBodyWriter. If the response entity has no body, no writer is invoked.

MessageBodyWriters use JSONService and JSONObject to convert and write out responses. The HALMessageBodyWriter writes a HAL-formatted JSONObject to a response, while the OracleJSONMessageBodyWriter converts the object to Oracle format and includes any embedded resources.

MessageBodyWriters use an output producer and filtering manager to render the resource representation state for output. They also add any links needed to the output. For embedded resources, the MessageBodyWriter classes use the internal client in the JAXRSApplication to invoke a GET through Jersey to retrieve the embedded resource. This means that the request is routed back through Jersey and will go through the entire framework process again to obtain a representation of the embedded resource. Once the embedded resource representation is retrieved it is added to the output. For additional information on embedded resources, refer to the Using Embedded Resources section.

On collection resources, members are retrieved by doing a lookup for the GET method, and directly invoking the collection to get each member resource representation model, which is then rendered for output using the output producer and filtering manager.

For detailed information on configuring resource filtering, refer to the Validating Input and Filtering Output section.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices