Asterisk after string in @RequestMapping

2019-08-11 05:41发布

问题:

What's the meaning of the asterisk in this case:

@RequestMapping(value = "/admin**", method = RequestMethod.GET)

What I understand is that * means space but what ** means after the admin? How does the double asterisk affect a url like "localhost:8080/project/admin"?

回答1:

Paths, like,

1. admin
2. admin123
3. adminavv
4. adminadmin

will be matched. Use request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE ) for getting "admin" + variable child path.



回答2:

Adding ** will match zero or more 'directories' in the path. Doing so, it will match anything who is 'children' of admin.