0

See following Spring REST example, if a request such as “http://localhost:8080/site/name/exemple#name” is submitted, Spring returns “exemple“ and extract half and delete text after #.

@Controller
@RequestMapping("/site")
public class SiteController {
@RequestMapping(value = "/name/{myname}", method = RequestMethod.GET)
//myname='exemple'
    ...
    }

How to fix it ?

amalicode
  • 37
  • 1
  • 8

1 Answers1

3

"#" is a reserved character in a URL. It must be escaped. It represents the beginning of the fragment portion of the URL. Thus, name is "exemple", and the fragment is "name".

Steve11235
  • 2,849
  • 1
  • 17
  • 18