SpringMVC URL 正则表达式
来源:互联网 发布:电脑淘宝怎么看信用 编辑:程序博客网 时间:2024/06/05 14:17
原文地址 https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html
带有正则表达式的URL地址
有的时候你需要精确的定义URL变量,考虑一下这个URL"/spring-web/spring-web-3.0.5.jar",如何分解为多个部分?
@RequestMapping
注解支持在URL地址中使用正则表达式变量,语法是 {varName:regex}
第一部分定义了变量的名称,第二部分定义了正则表达式,例如:@RequestMapping("/spring-web/{symbolicName:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}")public void handle(@PathVariable String version, @PathVariable String extension) { // ...}
URI Template Patterns with Regular Expressions
Sometimes you need more precision in defining URI template variables. Consider the URL "/spring-web/spring-web-3.0.5.jar"
. How do you break it down into multiple parts?
The @RequestMapping
annotation supports the use of regular expressions in URI template variables. The syntax is {varName:regex}
where the first part defines the variable name and the second - the regular expression. For example:
@RequestMapping("/spring-web/{symbolicName:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}")public void handle(@PathVariable String version, @PathVariable String extension) { // ...}
0 0
- SpringMVC URL 正则表达式
- springMVc @RequestMapping正则表达式模式的url
- url正则表达式提取
- 一个URL正则表达式
- java url 正则表达式
- URL网址正则表达式
- 正则表达式验证url
- 正则表达式匹配URL
- URL正则表达式大全
- 正则表达式验证URL
- url的正则表达式
- 正则表达式识别URL
- url正则表达式判断
- URL 正则表达式
- 正则表达式验证URL
- 正则表达式---url,ip
- 正则表达式匹配url
- 正则表达式验证URL
- 数据库中记录类
- web数据的传输
- 2015山东省第六届acm省赛 C题Game!
- Dubbo与Zookeeper、SpringMVC整合和使用(入门级)
- Spring Bean的生命周期
- SpringMVC URL 正则表达式
- 10种简单的Java性能优化
- Linked List Cycle II
- ubuntu14.04 root登陆与自动登陆配置方法及出现问题解决
- 独立游戏开发日记(1)
- tar打包 解压
- 有关v$asm_attribute视图的一点记录
- 【安卓逆向】如何不用设置debuggable="true"就可以动态调试
- 从零开始学算法(四)搜索算法(二)(广度优先搜索)