URLMapping将所有请求定向到单个控制器/操作 [英] URLMapping to direct all request to a single controller/action
本文介绍了URLMapping将所有请求定向到单个控制器/操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我喜欢开发一个API管理器。我希望,一个控制器可以接受所有请求。
如何将所有Web请求指向相同的控制器/操作,我应该决定进一步处理。 p>
我不知道如何配置URLMappings.groovy。可能我可以用过滤器做到这一点,但我不知道。
我会很感激您的支持。
谢谢
解决方案 在
URLMappings.groovy
, static mappings = {
/ **(controller:foo,action:bar)
}
会将所有网址指向 FooController
的 bar
动作。
I like to develop an API manager. I want, one single controller to accept all requests.
How can I direct all web requests to the same controller/action, where I should decide for farther processing.
I do not know how to configure the URLMappings.groovy. Possibly I could do that with filter but again I do not know.
I will appreciate your support.
Thanks
解决方案
In URLMappings.groovy
,
static mappings = {
"/**"(controller: "foo", action: "bar")
}
will direct all URLs to FooController
's bar
action.
这篇关于URLMapping将所有请求定向到单个控制器/操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文