protected void sendRedirect(HttpServletRequest request, HttpServletResponse response,
                                String targetUrl, boolean http10Compatible) throws IOException {
        String encodedRedirectURL = response.encodeRedirectURL(targetUrl);
        if (http10Compatible) {
            // Always send status code 302.
            response.sendRedirect(encodedRedirectURL);
        } else {
            // Correct HTTP status code is 303, in particular for POST requests.
            response.setStatus(HttpServletResponse.SC_SEE_OTHER);
            response.setHeader("Location", encodedRedirectURL);
        }
    }
Send a redirect back to the HTTP client

@param request          current HTTP request (allows for reacting to request method)
@param response         current HTTP response (for sending response headers)
@param targetUrl        the name URL to redirect to
@param http10Compatible whether to stay compatible with HTTP 1.0 clients
@throws IOException if thrown by response methods
web/src/main/java/org/apache/shiro/web/util/RedirectView.java