Grails url 映射执行错误的操作调用
Grails url mapping doing wrong action call
我正在尝试调用索引操作并继续调用计数操作,但我不知道为什么。这是 urlmapping
中的代码
group "/api/product",{
"?"(controller: 'product', action: 'save', method: 'POST')
"?"(controller: 'product', action: 'index', method: 'GET')
"/$id?"(controller: 'product', action: 'delete', method: 'DELETE')
"/$id?"(controller: 'product', action: 'update', method: 'PUT')
"/$id?"(controller: 'product', action: 'show', method: 'GET')
"/count?"(controller: 'product', action: 'count', method: 'GET')
}
尝试以下映射:
"/api/product/count"(controller:"product")
{
action = [GET:"count"]
}
"/api/product/$id"( controller:"product")
{
action = [GET: "show", PUT:"update",DELETE:"delete"]
}
"/api/product"( controller:"product")
{
action = [GET: "index", POST:"save"]
}
我正在尝试调用索引操作并继续调用计数操作,但我不知道为什么。这是 urlmapping
group "/api/product",{
"?"(controller: 'product', action: 'save', method: 'POST')
"?"(controller: 'product', action: 'index', method: 'GET')
"/$id?"(controller: 'product', action: 'delete', method: 'DELETE')
"/$id?"(controller: 'product', action: 'update', method: 'PUT')
"/$id?"(controller: 'product', action: 'show', method: 'GET')
"/count?"(controller: 'product', action: 'count', method: 'GET')
}
尝试以下映射:
"/api/product/count"(controller:"product")
{
action = [GET:"count"]
}
"/api/product/$id"( controller:"product")
{
action = [GET: "show", PUT:"update",DELETE:"delete"]
}
"/api/product"( controller:"product")
{
action = [GET: "index", POST:"save"]
}