I have two methods, one is supposed to handle login request issued by JS, another takes care of 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 seems to go to the getLoginPage method whether it has "x-requested-with:XMLHttpRequest" header or not. I doubled checked http headers, it contains correct head. So it seems Spring just ignores the login method.
I've been struggling with this for a while, any advice would be greatly appreciated, thanks!
headers
uses =
as a delimiter:
@RequestMapping(value = "/login", method = {RequestMethod.GET, RequestMethod.HEAD},
headers = "x-requested-with=XMLHttpRequest")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With