title: In spring mvc, headers = "x-requested-with:XMLHttpRequest" in request mapping not working?
body: <p>I have two methods, one is supposed to handle login request issued by JS, another takes care of login page.</p>
  
  <pre><code> @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() {......}
  </code></pre>
  
  <p>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.</p>
  
  <p>I've been struggling with this for a while, any advice would be greatly appreciated, thanks!</p>