private void redirectAfterLogout()

in src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java [1373:1396]


    private void redirectAfterLogout(final HttpServletRequest request,
            final HttpServletResponse response) {

        // nothing more to do if the response has already been committed
        if (response.isCommitted()) {
            log.debug("redirectAfterLogout: Response has already been committed, not redirecting");
            return;
        }

        // find the redirect target from the resource attribute or parameter
        // falling back to the request context path (or /) if not set or invalid
        String target = AuthUtil.getLoginResource(request, request.getContextPath());
        if (!AuthUtil.isRedirectValid(request, target)) {
            log.warn("redirectAfterLogout: Desired redirect target is invalid; redirecting to '/'");
            target = request.getContextPath() + "/";
        }

        // redirect to there
        try {
            response.sendRedirect(target); // NOSONAR The redirect is checked for validity using AuthUtil
        } catch (IOException e) {
            log.error("Failed to redirect to the page: " + target, e);
        }
    }