class HttpRequestWrapperProcessor implements Processor {

    @Override
    @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") // https://github.com/spotbugs/spotbugs/issues/259
    public void process(Exchange exchange) throws Exception {
        final Message message = exchange.getIn();
        final Object body = message.getBody();

        final ObjectNode rootNode = JsonUtils.copyObjectMapperConfiguration().createObjectNode();

        if (!parameters.isEmpty()) {
            final ObjectNode parametersNode = rootNode.putObject("parameters");

            final HttpServletRequest servletRequest = message.getHeader(Exchange.HTTP_SERVLET_REQUEST, HttpServletRequest.class);
            for (String parameter : parameters) {
                final String[] values;
                final String[] headerValues = message.getHeader(parameter, String[].class);
                if (servletRequest != null && headerValues == null) {
                    values = servletRequest.getParameterValues(parameter);
                } else {
                    values = headerValues;
                }

                putPrameterValueTo(parametersNode, parameter, values);
            }
        }

        if (body instanceof String) {
            final String string = (String) body;
            if (ObjectHelper.isNotEmpty(string)) {
                rootNode.set("body", READER.readValue(string));
            }
        } else if (body instanceof InputStream) {
            try (InputStream stream = (InputStream) body) {
                if (stream.available() > 0) {
                    rootNode.set("body", READER.readValue(stream));
                }
            }
        } else if (body != null) {
            rootNode.putPOJO("body", body);
        }

        final String newBody = JsonUtils.toString(rootNode);
        final Message replacement = new DefaultMessage(exchange.getContext());
        replacement.copyFromWithNewBody(message, newBody);

        // we rely on having the Content-Type match the body when we're
        // extracting parameters from the JSON body, otherwise we don't
        // know if the content is JSON or XML (or any future supported
        // content type)
        replacement.setHeader(Exchange.CONTENT_TYPE, "application/json");

        ExchangeHelper.replaceMessage(exchange, replacement, false);
    }

    public  HttpRequestWrapperProcessor(JsonNode schema);

}