Source:
public Object handle(Request request, Response response) throws Exception { String transformerId = request.params(":transformerId"); String body = util.safeGetBody(request); CqlRequest cqlRequest; try { cqlRequest = mapper.readValue(body, CqlRequest.class); } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) { LOGGER.debug("Error fetching cql request"); response.status(HttpStatus.BAD_REQUEST_400); return ImmutableMap.of("message", "Error retrieving cql request"); } if (cqlRequest.getCql() == null) { LOGGER.debug("Cql not found in request"); return ImmutableMap.of("message", "Cql not found in request"); } Map<String, Serializable> arguments = mapper.readValue(body, Arguments.class).getSerializableArguments(); LOGGER.trace("Finding transformer to transform query response."); ServiceReference<QueryResponseTransformer> queryResponseTransformer = queryResponseTransformers .stream() .filter(transformer -> transformerId.equals(transformer.getProperty("id"))) .findFirst() .orElse(null); if (queryResponseTransformer == null) { LOGGER.debug("Could not find transformer with id: {}", transformerId); response.status(HttpStatus.NOT_FOUND_404); return ImmutableMap.of("message", "Service not found"); } CqlQueryResponse cqlQueryResponse = util.executeCqlQuery(cqlRequest); Object schema = queryResponseTransformer.getProperty("schema"); if (queryResponseTransformer.getProperty("mime-type").toString().equals("[text/csv]")) { arguments = csvTransformArgumentsAdapter(arguments); } else if (schema != null && schema.toString().equals("<LINK_0>")) { arguments = cswTransformArgumentsAdapter(); } attachFileToResponse(request, response, queryResponseTransformer, cqlQueryResponse, arguments); return ""; }

Target:
public Object handle(Request request, Response response) throws Exception { String transformerId = request.params(":transformerId"); String body = util.safeGetBody(request); CqlRequest cqlRequest; try { cqlRequest = mapper.readValue(body, CqlRequest.class); } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) { LOGGER.debug("Error fetching cql request"); response.status(HttpStatus.BAD_REQUEST_400); return ImmutableMap.of("message", "Error retrieving cql request"); } if (cqlRequest.getCql() == null) { LOGGER.debug("Cql not found in request"); return ImmutableMap.of("message", "Cql not found in request"); } Map<String, Serializable> arguments = mapper.readValue(body, Arguments.class).getSerializableArguments(); LOGGER.trace("Finding transformer to transform query response."); ServiceReference<QueryResponseTransformer> queryResponseTransformer = queryResponseTransformers .stream() .filter(transformer -> transformerId.equals(transformer.getProperty("id"))) .findFirst() .orElse(null); if (queryResponseTransformer == null) { LOGGER.debug("Could not find transformer with id: {}", transformerId); response.status(HttpStatus.NOT_FOUND_404); return ImmutableMap.of("message", "Service not found"); } CqlQueryResponse cqlQueryResponse = util.executeCqlQuery(cqlRequest); Object schema = queryResponseTransformer.getProperty("schema"); List<String> mimeTypeServiceProperty = queryResponseTransformer.getProperty("mime-type") instanceof List ? (List) queryResponseTransformer.getProperty("mime-type") : Collections.emptyList(); if (mimeTypeServiceProperty.contains("text/csv")) { arguments = csvTransformArgumentsAdapter(arguments); } else if (schema != null && schema.toString().equals(CswConstants.CSW_NAMESPACE_URI)) { arguments = cswTransformArgumentsAdapter(); } attachFileToResponse(request, response, queryResponseTransformer, cqlQueryResponse, arguments); return ""; }