use of org.codice.ddf.catalog.ui.query.cql.CqlRequest in project ddf by codice.
the class QueryApplication method init.
@Override
public void init() {
post("/cql", APPLICATION_JSON, (req, res) -> {
CqlRequest cqlRequest = mapper.readValue(req.body(), CqlRequest.class);
CqlQueryResponse cqlQueryResponse = executeCqlQuery(cqlRequest);
String result = mapper.toJson(cqlQueryResponse);
return result;
});
after("/cql", (req, res) -> {
res.type(APPLICATION_JSON);
res.header("Content-Encoding", "gzip");
});
exception(UnsupportedQueryException.class, (e, request, response) -> {
response.status(400);
response.body("Unsupported query request.");
LOGGER.error("Query endpoint failed", e);
});
exception(Exception.class, (e, request, response) -> {
response.status(500);
response.body("Error while processing query request.");
LOGGER.error("Query endpoint failed", e);
});
enableRouteOverview();
}
Aggregations