0

I have a controller with the following GetMapping

@GetMapping(value = "/{path}") 
     public ResponseEntity searchAPI(@PathVariable("path") String API_NAME)

but I have to exclude /index.html from this GetMapping

I tried like this

@GetMapping(value = "/{path:^.*(?!index.html)}") 

but this is not working Do I need to write each API seperatly? Please Help me

1 Answers1

1

Dot (.) is a special character to match any sign, you need to escape it with a backslash:

@GetMapping(value = "/{path:^(?!index\.html).*}") 
mehowthe
  • 761
  • 6
  • 14