public static void redirectToSavedRequest(ServletRequest request, ServletResponse response, String fallbackUrl)
            throws IOException {
        String successUrl = null;
        boolean contextRelative = true;
        SavedRequest savedRequest = WebUtils.getAndClearSavedRequest(request);
        if (savedRequest != null && savedRequest.getMethod().equalsIgnoreCase(AccessControlFilter.GET_METHOD)) {
            successUrl = savedRequest.getRequestUrl();
            contextRelative = false;
        }

        if (successUrl == null) {
            successUrl = fallbackUrl;
        }

        if (successUrl == null) {
            throw new IllegalStateException("Success URL not available via saved request or via the "
                    + "successUrlFallback method parameter. One of these must be non-null for "
                    + "issueSuccessRedirect() to work.");
        }

        WebUtils.issueRedirect(request, response, successUrl, null, contextRelative);
    }
Redirects the to the request url from a previously
{@link #saveRequest(javax.servlet.ServletRequest) saved} request, or if there is no saved request, redirects the
end user to the specified {@code fallbackUrl}.  If there is no saved request or fallback url, this method
throws an {@link IllegalStateException}.
<p/>
This method is primarily used to support a common login scenario - if an unauthenticated user accesses a
page that requires authentication, it is expected that request is
{@link #saveRequest(javax.servlet.ServletRequest) saved} first and then redirected to the login page. Then,
after a successful login, this method can be called to redirect them back to their originally requested URL, a
nice usability feature.

@param request     the incoming request
@param response    the outgoing response
@param fallbackUrl the fallback url to redirect to if there is no saved request available.
@throws IllegalStateException if there is no saved request and the {@code fallbackUrl} is {@code null}.
@throws IOException           if there is an error redirecting
@since 1.0
web/src/main/java/org/apache/shiro/web/util/WebUtils.java