Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between / and /**

Tags:

url

spring-mvc

I am confused between the URL pattern / and /** w.r.t AntPAthMatcher.

I know /** is a universal pattern that will match all the URLs, but I am not sure what does / will match.

I have tried searching the difference, but no help.

like image 613
coder Avatar asked Jul 11 '26 10:07

coder


1 Answers

/** will match any number of (0 or more) levels in a path, eg. it would match both /file and /some/path/file.

A single asterisk /* only matches 0 or more characters (not path levels) so it would match /file but not /some/path/file.

A single slash / would only match the root path.

like image 161
MattR Avatar answered Jul 14 '26 12:07

MattR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!