In a controller when should you use @CookieValue ?
Only when you know that you are sure that the 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 the cookie is set, no problem the method is called, but when the cookie is not set the method is not called and I think I can not have another method in my controller mapped to the same path.
(my version of Spring: 3.2.3)