public void doFilter()

in src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChain.java [78:126]


    public void doFilter(final ServletRequest request, final ServletResponse response)
            throws ServletException, IOException {
        if (firstCall) {
            if (request.getAttribute(RECURSION_ATTRIBUTE) != null) {
                if (this.mode == Mode.STATUS) {
                    if (message == null) {
                        LOG.warn(PREFIX_RECURSION.concat(String.valueOf(status)));
                    } else {
                        LOG.warn(PREFIX_RECURSION
                                .concat(String.valueOf(status))
                                .concat(" : ")
                                .concat(message));
                    }
                } else {
                    if (throwable.getMessage() != null) {
                        LOG.warn(PREFIX_RECURSION.concat(throwable.getMessage()), throwable);
                    } else {
                        LOG.warn(PREFIX_RECURSION.concat(throwable.getClass().getName()), throwable);
                    }
                }
                return;
            }
            request.setAttribute(RECURSION_ATTRIBUTE, "true");
            firstCall = false;
            // do nothing if response is already committed
            if (response.isCommitted()) {
                if (this.mode == Mode.STATUS) {
                    if (message == null) {
                        LOG.warn(PREFIX_COMMITTED.concat(String.valueOf(status)));
                    } else {
                        LOG.warn(PREFIX_COMMITTED
                                .concat(String.valueOf(status))
                                .concat(" : ")
                                .concat(message));
                    }
                } else {
                    if (throwable.getMessage() != null) {
                        LOG.warn(PREFIX_COMMITTED.concat(throwable.getMessage()), throwable);
                    } else {
                        LOG.warn(PREFIX_COMMITTED.concat(throwable.getClass().getName()), throwable);
                    }
                }
                return;
            }
            // reset the response to clear headers and body
            response.reset();
        }
        super.doFilter(request, response);
    }