class StringRegexpReplaceResponseFormatter implements ResponseFormatter {

    @Override
    public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp,
                                 final byte[] templateResource, final ParameterList params) throws Exception {
        byte[] result = templateResource;
        String template = null;
        if (!params.getAllParameters().isEmpty()) {
            template = getTemplate(templateResource, params);
            result = template.getBytes(StandardCharsets.UTF_8);
        }
        return result;
    }

}