【问题标题】:Grails url redirection problemsGrails url 重定向问题
【发布时间】:2012-02-10 13:34:28
【问题描述】:

我有一个 Grails 2.0 webapp,当我尝试访问一个 url 时,例如 http://localhost:8080/${myapp}/controller/action 它总是重定向到 http://localhost:8080/controller/action 而没有我的 webapp 的名称。 这是我的 UrlMappings.groovy

class UrlMappings {
static mappings = {
  "/$controller/$action?/$id?"{
      constraints {
         // apply constraints here
      }
  }

  "/"(controller:"/admin")
  "500"(view:'/error')
}

}

这是我的 application.properties

#Grails Metadata file
#Thu Feb 09 12:22:14 CET 2012
app.grails.version=2.0.0
app.name=appname
app.servlet.version=2.4
app.version=0.1
plugins.hibernate=2.0.0
plugins.tomcat=2.0.0

任何建议为什么它重定向到错误的网址?

感谢您的宝贵时间

【问题讨论】:

  • 您是否在Config.groovy 中设置了grails.app.context="/appname"
  • 谢谢你的回复,我周一试试,我不在办公室

标签: grails redirect


【解决方案1】:

问题解决了。在 Config.groovy 我的服务器 url 错误

grails.serverURL="http://localhost:8080"

我不得不使用

grails.serverURL="http://localhost:8080/appname"

谢谢

【讨论】:

  • 这个答案以另一种方式帮助了我。我们之前没有在 Config.groovy 中使用此设置。最近有人签入了这条线路,我的本地 grails 应用程序正在重定向到这个特定的 8080 URL,即使我在 8080 以外的其他端口上运行它。
猜你喜欢
  • 2021-03-30
  • 1970-01-01
  • 1970-01-01
  • 2012-10-07
  • 2017-06-01
  • 2018-02-14
  • 2015-11-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多