I have two methods: one must handle the login request issued by JS, the other takes care of the login page.
@RequestMapping(value = "/login", method = {RequestMethod.GET, RequestMethod.HEAD},
headers = "x-requested-with:XMLHttpRequest")
public @ResponseBody String login() {...}
@RequestMapping(value = "/login", method = {RequestMethod.GET, RequestMethod.HEAD})
public String getLoginPage() {......}
However, all the login requests seem to be related to the getLoginPage method, whether it has the header "x-request-with: XMLHttpRequest" or not. I doubled the verified http headers, it contains the correct head. Therefore, it seems that Spring is simply ignoring the login method.
I struggled with this for a while, any advice would be greatly appreciated, thanks!
source
share