public void process()

in wilma-application/modules/wilma-core/src/main/java/com/epam/wilma/core/processor/entity/PrettyPrintProcessor.java [62:84]


    public void process(final WilmaHttpEntity entity) throws ApplicationException {
        String body = entity.getBody();
        if ((body == null) || (body.length() == 0)) {
            return; //actually we have nothing to print pretty :)
        }
        String contentTypeHeader = entity.getHeader("Content-Type");
        if (contentTypeHeader != null && contentTypeHeader.contains("xml") && !contentTypeHeader.contains("image/svg+xml")) {
            try {
                Transformer transformer = transformerFactory.createTransformer();
                transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                StreamResult result = streamResultFactory.createStreamResult();
                StreamSource source = streamSourceFactory.createStreamSourceFromString(body);
                transformer.transform(source, result);
                String xmlString = result.getWriter().toString();
                entity.setBody(xmlString);
            } catch (TransformerException e) {
                logError(entity, e);
            }
        } else if (contentTypeHeader != null && contentTypeHeader.contains("json")) {
            handleJsonContent(entity);
        }

    }