private SavedRequest getSavedRequest(ServletRequest request) {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpSession httpSession = httpRequest.getSession(false);
if (httpSession == null) {
return new SavedRequest(httpRequest, new PortResolverImpl());
} else {
return (SavedRequest) httpSession.getAttribute(AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY);
}
}