创建Grails catch-all URL映射

kno*_*orv 5 grails url-rewriting

如何在Grails中创建一个包罗万象的URL映射?

以下Grails UrlMapping ..

class UrlMappings {
  static mappings = {
    "/$something"{
      controller = "something"
      action = "something"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

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

ata*_*lor 15

你正在寻找**"双通配符".例:

   class UrlMappings {
      static mappings = {
        "/**"(controller: "something", action: "something")
      }
    }
Run Code Online (Sandbox Code Playgroud)