Code example for ServletWebRequest

0
    private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy(); 
 
    @Override 
    public void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url) throws IOException { 
        if (BroadleafControllerUtility.isAjaxRequest(request)) { 
            if (BLCRequestUtils.isOKtoUseSession(new ServletWebRequest(request))) { 
                request.getSession().setAttribute("BLC_REDIRECT_URL", url); 
            } 
            url = getRedirectPath(); 
        } 
        redirectStrategy.sendRedirect(request, response, url); 
    } 
 
    public String updateLoginErrorUrlForAjax(String url) { 
        String blcAjax = BroadleafControllerUtility.BLC_AJAX_PARAMETER; 
        if (url != null && url.indexOf("?") > 0) { 
            url = url + "&" + blcAjax + "=true"; 
        } else { 
            url = url + "?" + blcAjax + "=true"; 
        }