In the controller, when should you use @CookieValue?
Only when you know that you are sure that a cookie will be present?
I have this controller:
@Controller @RequestMapping("my") public class MyController { @RequestMapping("") public ModelAndView index(@CookieValue("myCookie") String cookie, Map<String, Object> model){ log.info("My cookie {}", cookie); (...) }
When a cookie is set, there is no problem called by the method, but when the cookie is not set, the method is not called, and I think that I cannot have another method in my controller that maps to the same path.
(my Spring version: 3.2.3)
source share