REST API responses
One of the final steps in handling a REST request is the serialization of the HTTP
response. During this step, it is necessary to serialize both the response body and the
response headers:
- The REST API framework writes the response body to the output stream of the HttpServletResponse servlet container.
- The REST API framework turns the response headers into
Stringobjects that the servlet container is responsible for writing to the response.
The REST API Framework supports the serialization of a number of different Java object
types that the API handler method can return directly, using one of the following ways:
- Set the object as the value of the body of the
Responseobject. - Add the object as the value of a header on the
Responseobject.
