grails - Grails URL映射问题

标签 grails

我正在使用Grails 1.2.1。我想设置此映射...

http://localhost:8080/context-path/mediaproxy

所以我将此添加到我的URLMappings.groovy文件中...

class UrlMappings {
    static mappings = {
      ‰name mediaproxy: "/mediaproxy" {
          controller = "SocialMediaCacheProxy"
          action = "index"
      }
      "/"(view:"/index")
      "500"(view:'/error')
    }

}

但是,访问上述URL时得到404。这是我设置 Controller 的方式
class SocialMediaCacheProxyController {

    def index = {
        if (params.dumpAll != null) {

        } else if (params.url != null) {
            doCacheTransport(params, response); 
        }   // if
    }

...
}

有什么想法我做错了吗?谢谢-戴夫

最佳答案

您的命名映射(‰)前面有一些奇怪的字符,并且您的 Controller 名称在第一个字符上应小写,以使其指向SocialMediaCacheProxyController。

如果您不需要命名映射,则以下映射将为您解决问题:

class UrlMappings {
    static mappings = {
        "/mediaproxy"(controller:"socialMediaCacheProxy", action:"index")
        "/"(view:"/index")
        "500"(view:'/error')
    }
}

关于grails - Grails URL映射问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5343382/

相关文章:

grails - 为什么grails中没有用于过滤器的拦截器

grails - 在 Grails 中用自己的方法扩展 SpEL?

hibernate - 从 grails 域的属性中获取数据库列名

grails 分离信息记录

grails - 是什么 ?关于常规变量?

maven - 无法找出Maven问题

grails - 阻止 Grails 在 Controller 中生成某些方法?

grails - Groovy/Grails 入门?

spring - 如何防止JA-SIG CAS Spring安全重定向循环?

java - Spock 测试因 NullPointerException 失败