创建Grails catch-all URL映射

时间:2009-10-29 23:08:42

标签: grails url-rewriting

如何在Grails中创建全能网址映射?

以下Grails UrlMapping ..

class UrlMappings {
  static mappings = {
    "/$something"{
      controller = "something"
      action = "something"
    }
  }
}

..似乎与^/[^/]*匹配,但如何创建与所有网址匹配的UrlMapping(^/.*)?

1 个答案:

答案 0 :(得分:15)

你正在寻找**“双通配符”。例如:

   class UrlMappings {
      static mappings = {
        "/**"(controller: "something", action: "something")
      }
    }