我正在使用Grails和RESTful来开发我的Web应用程序.一切正常,直到我将我的应用程序升级到Grails 2.3.这是我的UrlMappings:我仍然发送请求,提交或正常做一些其他事情,但在POST,PUT请求中,参数丢失.服务器只识别我直接放在URL上的参数,但是当在"params"变量中找不到提交时,我在表单或模型中包含的剩余部分.他是我的UrlMappings:
class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{ constraints {} }
name apiSingle: "/api/$controller/$id"(parseRequest:true){
action = [GET: "show", PUT: "update", DELETE: "delete"]
constraints { id(matches:/\d+/) }
}
name apiCollection: "/api/$controller"(parseRequest:true){
action = [GET: "list", POST: "save"]
}
name api2: "/api/$controller/$action"(parseRequest:true)
name api3: "/api/$controller/$action/$id"(parseRequest:true)
"/"(view:"/welcome")
"500"(view:'/error')
}
}
Run Code Online (Sandbox Code Playgroud)
我已经在http://grails.org/doc/latest/guide/theWebLayer.html#restfulMappings上阅读了Grails 2.3的最新文档,
但我认为目前尚不清楚.我试过它按照文档但没有结果.并且没有任何关于使用Grails 2.3和RESTful的示例供我参考.
如何使其像以前一样正常工作,并可以访问REST请求中的所有参数值?非常感谢!