Url in the spring restful service path variable

When I pass the email address as a path variable, it produces the following error

    Console --> 2015-02-09 16:30:06,634 WARN  - GET request for "http://localhost:8181/abc/users/testabghtmail@gmail.com" 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 tried many cases, so I finally found a problem with the latter domain, for example .com and .org , which internationalize domains. So instead of " testabghtmail@gmail.com ", if I go through " testabghtmail@gmail.dom ", it will work fine.

My code

@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);
}
+4
source share
1 answer

I did not find an answer to this. I think this is an http rule in which we cannot have domains at last in prameters and can make a request.

, , URL- .

" http://localhost:8181/abc/users/testabghtmail@gmail.com/" " http://localhost:8181/abc/users/testabghtmail@gmail.com". spring , "testabghtmail@gmail.com" .

, , , - .

+4

All Articles