When I am passing email address as path variable it is throwing following error
Console --> 2015-02-09 16:30:06,634 WARN - GET request for "http://localhost:8181/abc/users/[email protected]" resulted in 406 (Not Acceptable); invoking error handler Exception in thread "main" org.springframework.web.client.HttpClientErrorException: 406 Not Acceptable at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:607) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:565) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:521) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:439) at RestClient.main(RestClient.java:35) I have tried lots of cases, so I finally found the problem with last domain like .com and .org which are internationalize domains. So instead of "[email protected]" if I pass "[email protected]" it will work perfectly fine.
My code is
@RequestMapping(value = "users/{emailId:.*}", method = RequestMethod.GET) public Object searchUser(@PathVariable("emailId") String emailId){ logger.info("Inside search user --> emailId " + emailId); return userService.findUserByuserId(emailId); }