简体   繁体   中英

Grails 3 Url Mappings

How does one create a default, match all pattern?

For Ex:

"/"(controller: "home", action: "index")
"401"(controller: "error", action: "unauthorized")
"404"(controller: "error", action: "nF")
"500"(controller: "error", action: "err")

When the user hits an application http://myapp.com/appName/ , the / mapping gets invoked. How do we add a pattern so that even the url http://myapp.com/appName (without the fordward slash) gets invoked?

I have tried to do the following so far:

""(controller: "home", action: "index")
" "(controller: "home", action: "index")
"*"(controller: "home", action: "index")
"*/**"(controller: "home", action: "index")
any(controller: "home", action: "index")

But all result in several errors, out of which, some include:

MissingMethodException: No signature of method: org.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.any() is applicable for argument types:
No signature of method: org.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.*/**() is applicable for argument types:

模式应始终以正斜杠开头:

 "/**"(controller: "home", action: "index")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM