Adding UrlMapping constraints to a VERB-mapped url?

家住魔仙堡 提交于 2019-12-14 03:21:48

问题


Is it possible to add constraints to HTTP verb-matched Url Mappings?

Here's my current definition:

    "/a/$param1/b" {
        controller = "a"
        action = [GET: 'method1',
                  POST: 'method2'
                 ]
    }

回答1:


Sure, this seems to work:

"/rest/$controller/$id?"(parseRequest:true) {
        action = [GET: "show", POST: "update", PUT:"save", DELETE:"delete"]
        constraints { id(matches:/[0-9]+/) }
    }


来源:https://stackoverflow.com/questions/5356916/adding-urlmapping-constraints-to-a-verb-mapped-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!