Package com.yahoo.restapi
Class JacksonJsonResponse<T>
java.lang.Object
com.yahoo.container.jdisc.HttpResponse
com.yahoo.restapi.JacksonJsonResponse<T>
A JSON response using Jackson for serialization.
- Author:
- bjorncs
-
Field Summary
Fields inherited from class com.yahoo.container.jdisc.HttpResponse
DEFAULT_CHARACTER_ENCODING, DEFAULT_MIME_TYPE
-
Constructor Summary
ConstructorDescriptionJacksonJsonResponse
(int statusCode, T entity) JacksonJsonResponse
(int statusCode, T entity, boolean prettyPrint) JacksonJsonResponse
(int statusCode, T entity, com.fasterxml.jackson.databind.ObjectMapper jsonMapper) JacksonJsonResponse
(int statusCode, T entity, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean prettyPrint) -
Method Summary
Modifier and TypeMethodDescriptionThe MIME type of the response contents or null.void
render
(OutputStream outputStream) Marshals this response to the network layer.Methods inherited from class com.yahoo.container.jdisc.HttpResponse
complete, getCharacterEncoding, getJdiscResponse, getLogValues, getRequestType, getStatus, headers, maxPendingBytes, populateAccessLogEntry, setRequestType, setStatus
-
Constructor Details
-
JacksonJsonResponse
-
JacksonJsonResponse
-
JacksonJsonResponse
public JacksonJsonResponse(int statusCode, T entity, com.fasterxml.jackson.databind.ObjectMapper jsonMapper) -
JacksonJsonResponse
public JacksonJsonResponse(int statusCode, T entity, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, boolean prettyPrint)
-
-
Method Details
-
render
Description copied from class:HttpResponse
Marshals this response to the network layer. The caller is responsible for flushing and closing outputStream.- Specified by:
render
in classHttpResponse
- Throws:
IOException
-
getContentType
Description copied from class:HttpResponse
The MIME type of the response contents or null. If null is returned, no content type header is added to the HTTP response.- Overrides:
getContentType
in classHttpResponse
- Returns:
- by default
HttpResponse.DEFAULT_MIME_TYPE
-
getEntity
-