URLMapping to direct all request to a single contr

2019-09-08 14:51发布

问题:

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

回答1:

In URLMappings.groovy,

static mappings = {
    "/**"(controller: "foo", action: "bar")
}

will direct all URLs to FooController's bar action.