I'm using AngularJS 1.4 and a Spring 4 RestController. When I make a GET request on my development machine, everything works fine. But when I deploy the exact same war file to our test server, exact same request from exact same browser returns HTTP 406 Not Acceptable.
Only difference between two environment is on my development machine I'm using embedded Tomcat 8, whereas on test server app is deployed on Tomcat 7.
My request consists of a single path variable which contains an email address.
angularjs code which makes the request:
utilService.emailD = function(email) {
return $http({
method : 'GET',
url : 'util/emailD/' + encodeURIComponent(email)
}).then(
function successCallback(response) {
return response.data;
},
function errorCallback(response) {
return {
error : true
};
});
}
Spring controller which accepts request
@RequestMapping(value = "/emailD/{email:.+}",
method = RequestMethod.GET,
produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> emailD(@Email @Valid @PathVariable(value = "email") String email) {
try {
log.debug("request emailD, email: {}", email);
//omitted irrelevant code
return new ResponseEntity<String>(someString, HttpStatus.OK);
} catch (IllegalArgumentException iae) {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
Is there any reason you can think of that may cause such behavior?