return new ModelAndView(new RedirectView(urlRedirect));
}
@RequestMapping(value = FoUrls.CART_CREATE_ACCOUNT_URL, method = RequestMethod.GET)
public ModelAndView displayCheckoutCreateAccount(final HttpServletRequest request, final Model model, @ModelAttribute(ModelConstants.FRONTOFFICE_CREATE_ACCOUNT_FORM) CreateAccountForm createAccountForm) throws Exception {
ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.CUSTOMER_CREATE_ACCOUNT.getVelocityPage());
final RequestData requestData = requestUtil.getRequestData(request);
// SANITY CHECK: Customer logged
final Customer currentCustomer = requestData.getCustomer();
if(currentCustomer != null){
final String url = urlService.generateUrl(FoUrls.CART_DELIVERY, requestUtil.getRequestData(request));
return new ModelAndView(new RedirectView(url));
}
final List<String> excludedPatterns = new ArrayList<String>();
excludedPatterns.add(FoUrls.CUSTOMER_CREATE_ACCOUNT.getUrlWithoutWildcard());
final String lastUrl = requestUtil.getLastRequestUrl(request, excludedPatterns, urlService.generateUrl(FoUrls.HOME, requestUtil.getRequestData(request)));
modelAndView.addObject(ModelConstants.URL_BACK, lastUrl);
modelAndView.addObject(ModelConstants.CHECKOUT_STEP, 2);
return modelAndView;
}