@Singleton public class HttpResponseMaker extends Object
| Modifier and Type | Field and Description |
|---|---|
protected DimensionDictionary |
dimensionDictionary |
protected ObjectMappersSuite |
objectMappers |
protected ResponseWriter |
responseWriter |
| Constructor and Description |
|---|
HttpResponseMaker(ObjectMappersSuite objectMappers,
DimensionDictionary dimensionDictionary,
ResponseWriter responseWriter)
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.Response |
buildErrorResponse(int statusCode,
String reason,
String description,
DruidQuery<?> druidQuery)
Prepare Response object from error details with reason and description.
|
javax.ws.rs.core.Response |
buildResponse(PreResponse preResponse,
ApiRequest apiRequest)
Build complete response.
|
protected ResponseData |
buildResponseData(ResultSet resultSet,
LinkedHashSet<String> apiMetricColumnNames,
LinkedHashMap<Dimension,LinkedHashSet<DimensionField>> requestedApiDimensionFields,
SimplifiedIntervalList partialIntervals,
SimplifiedIntervalList volatileIntervals,
Pagination pagination,
Map<String,URI> paginationLinks)
Builds a ResponseData object.
|
protected final ObjectMappersSuite objectMappers
protected final DimensionDictionary dimensionDictionary
protected final ResponseWriter responseWriter
@Inject public HttpResponseMaker(ObjectMappersSuite objectMappers, DimensionDictionary dimensionDictionary, ResponseWriter responseWriter)
objectMappers - Mappers object for serializationdimensionDictionary - The dimension dictionary from which to look up dimensions by nameresponseWriter - Serializer which takes responseData and apiRequest, outputs formatted data stream.public javax.ws.rs.core.Response buildResponse(PreResponse preResponse, ApiRequest apiRequest)
preResponse - PreResponse object which contains result set, response context and headersapiRequest - ApiRequest object which contains request related informationpublic javax.ws.rs.core.Response buildErrorResponse(int statusCode,
String reason,
String description,
DruidQuery<?> druidQuery)
statusCode - Error status codereason - Brief reason about the errordescription - Description of the errordruidQuery - Druid query associated with the an errorprotected ResponseData buildResponseData(ResultSet resultSet, LinkedHashSet<String> apiMetricColumnNames, LinkedHashMap<Dimension,LinkedHashSet<DimensionField>> requestedApiDimensionFields, SimplifiedIntervalList partialIntervals, SimplifiedIntervalList volatileIntervals, Pagination pagination, Map<String,URI> paginationLinks)
resultSet - ResultSet to turn into responseapiMetricColumnNames - The names of the logical metrics requestedrequestedApiDimensionFields - The fields for each dimension that should be shown in the responsepartialIntervals - intervals over which partial data existsvolatileIntervals - intervals over which data is understood as 'best-to-date'pagination - The object containing the pagination information. Null if we are not paginatingpaginationLinks - A mapping from link names to links to be added to the end of the JSON responseCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.