将UrlMapping约束添加到VERB映射的url? [英] Adding UrlMapping constraints to a VERB-mapped url?
本文介绍了将UrlMapping约束添加到VERB映射的url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以向HTTP动词匹配的Url映射添加约束?
Is it possible to add constraints to HTTP verb-matched Url Mappings?
这是我目前的定义:
"/a/$param1/b" {
controller = "a"
action = [GET: 'method1',
POST: 'method2'
]
}
推荐答案
确定,这似乎工作:$ / b>
Sure, this seems to work:
"/rest/$controller/$id?"(parseRequest:true) {
action = [GET: "show", POST: "update", PUT:"save", DELETE:"delete"]
constraints { id(matches:/[0-9]+/) }
}
这篇关于将UrlMapping约束添加到VERB映射的url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文