Asterisk after string in @RequestMapping

2019-08-11 05:17发布

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"?

2条回答
Root(大扎)
2楼-- · 2019-08-11 05:44

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.

查看更多
走好不送
3楼-- · 2019-08-11 05:44

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

查看更多
登录 后发表回答