@RequestMapping(FoUrls.CONTEXT_URL)
public ModelAndView context(final HttpServletRequest request, final Model model) throws Exception {
ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.CONTEXT.getVelocityPage());
final RequestData requestData = requestUtil.getRequestData(request);
final VelocityPageContextDataPojo context = new VelocityPageContextDataPojo();
// TODO : move this value in a EngineSetting
context.setCartMaxItemQuantity(5);
UrlPojo url = new UrlPojo();
url = new UrlPojo();
url.setCode(FoUrls.ADD_TO_WISHLIST_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.ADD_TO_WISHLIST_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.GET_CART_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.GET_CART_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.ADD_TO_CART_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.ADD_TO_CART_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.UPDATE_CART_ITEM_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.UPDATE_CART_ITEM_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.DELETE_CART_ITEM_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.DELETE_CART_ITEM_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.SET_SHIPPING_ADDRESS_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.SET_SHIPPING_ADDRESS_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.SET_BILLING_ADDRESS_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.SET_BILLING_ADDRESS_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
url = new UrlPojo();
url.setCode(FoUrls.SET_DELIVERY_METHOD_AJAX.name());
url.setUrl(urlService.generateUrl(FoUrls.SET_DELIVERY_METHOD_AJAX, requestData));
url.setMethod("GET");
context.getUrls().add(url);
ObjectMapper mapper = new ObjectMapper();
try {
String contextJson = mapper.writeValueAsString(context);
model.addAttribute(ModelConstants.CONTEXT_JSON, contextJson);