开发者

another grails urlmapping question

开发者 https://www.devze.com 2023-01-07 05:48 出处:网络
ok, so i asked, and got an answer on how to make a single controller instance case-insensitive vis-a-vis urls. I can do

ok, so i asked, and got an answer on how to make a single controller instance case-insensitive vis-a-vis urls. I can do

"/mycontroller/$action?/$id?"(controller: "myController")

so when an app outside tries to reference link in our app, their lowercase urls ( :( sigh ) will work.

I need to extend this to include actions as well. So the question is, following the above approach, do i need put a url mapping in for each action?

/mycontroller/methodone/(controller: "myController", action: methodOne)
/mycontroller/methodtwo/(controller: "myController", action: meth开发者_如何学JAVAodTwo)

Something like the above?


This is similar to the question below which I have answered and included source code

How to make my URL mapping case insensitive?


You can use a closure to calculate the action (or other parameters) programmatically:

"/mycontroller/$a?/$id?" {
    controller = 'myController'
    action = { params.a?.toLowerCase() }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号