T
- the type of the raw datapublic class JsonResponse<T> extends AbstractResponse<T>
entries, objectMappers, pages, uriInfo
Constructor and Description |
---|
JsonResponse(Stream<T> entries,
Pagination<?> pages,
javax.ws.rs.core.UriInfo uriInfo,
String responseName,
ObjectMappersSuite objectMappers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
write(OutputStream os)
Generates JSON response.
|
addLink, addLink, addLink, addLinks, addLinks, getResponseStream, writeMetaObject
public JsonResponse(Stream<T> entries, Pagination<?> pages, javax.ws.rs.core.UriInfo uriInfo, String responseName, ObjectMappersSuite objectMappers)
entries
- The data entries to generate the response forpages
- The paginated set of results containing the pages being linked to.uriInfo
- UriInfo to generate the URL for the page linksresponseName
- Top level name of json object described the response data.objectMappers
- Suite of Object Mappers to use when serializing the responsepublic void write(OutputStream os) throws IOException
format:
{ "responseName" : [ { "id" : 1234, "description" : "description of dimension value", }, { "id" : 1235, "description" : "another description", } ], "meta" : { "pagination" : { "paginationLinks" : { "first" : "http://first_page_uri/", (optional) "last" : "http://last_page_uri/", (optional) "next" : "http://next_page_uri/", (optional) "previous": "http://previous_page_uri/" (optional) }, "currentPage": number of current page, "rowsPerPage": number of rows per page, "numberOfResults": number of results } } }
write
in class AbstractResponse<T>
os
- Output stream to write toIOException
- if there's a problem writing to the streamCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.