I have 2 controllers (with methods GET and POST) that are secured through spring-security w/ csrf protection. Both pages work ok when user is logged in.
After user is logged out or session is expired, accessing the GET page redirects to login page. However, accessing the POST page returns 'HTTP Status 405 - Request method 'POST' not supported'. What is required to redirect a POST request to login page instead?
@RequestMapping(value = "/home", method=RequestMethod.GET)
public ModelAndView home() {
return new ModelAndView("home");
}
@RequestMapping(value = "/home", method=RequestMethod.POST)
public ModelAndView homie() {
return new ModelAndView("home");
}