0
 @RequestMapping(value = "/analyst/getcompany/{user}", method = RequestMethod.GET, produces = "application/json")
        public String getEmail(@PathVariable String user) {
    //logic
    }

when requesting this URI with:

"analyst/getcompany/Abc@gmail.com"

It is giving HTTP Status 406.

I encode the @ with %40 but {.} in the email id is creating a problem. how to handle this?

  • Possible duplicate of [Spring MVC @PathVariable with dot (.) is getting truncated](https://stackoverflow.com/questions/16332092/spring-mvc-pathvariable-with-dot-is-getting-truncated) – alfcope Oct 12 '17 at 13:08
  • @Prashant can you share how you resolved this issue? – WannaBeGeek Jan 20 '21 at 08:07

1 Answers1

1

This answer will help you. Path variable truncate after dot - annotation

You have to add trailing slash at the end of the path variable after name like

@RequestMapping(value ="/analyst/getcompany/{user}/")

The Request like

http://localhost:8080/analyst/getcompany/Abc@gmail.com/

mrtasln
  • 574
  • 1
  • 5
  • 18
  • I found that it is advisable not to use trailing slash because it is not maintainable, if found that @ and .c,.co are accepted but .com is giving 406. for eg. abc@gmail.co,abc@gmail.ss are accepted but abc@gmail.com is not working as the suffix .com is the real cause. – Prashant Kumar Oct 13 '17 at 06:44