默认 Grails '/'控制器映射无法正确解析

发布于 2024-08-17 16:20:34 字数 684 浏览 3 评论 0原文

今天这个让我发疯了。自从升级到 Grails 1.2 和 Weblogic 10.3 后,“/”的默认根映射就停止工作了。这就是我所拥有的...

我有这个 URL 映射:

"/"(controller:"IGive", action:"index" )

我有一个名为 IGiveController 的控制器,带有索引闭包

def index = {
    render "foo"
}

当我使用 http://localhost:8080/mycontext/ 我得到“foo”返回的属性。但是当我构建一个war并部署到Weblogic 10.3时,我得到了404。

我降级到Grails 1.1.2,它仍然无法在Weblogic 10.3上工作,但错误更具描述性

Could not open ServletContext resource [/WEB-INF/grails-app/views/index.gsp] 

所以看起来它完全忽略了我的URL映射“/”,但其他更深层次的 URL 映射正在工作。有什么线索吗??

This one has been driving me crazy today. Since upgrading to Grails 1.2 and Weblogic 10.3 the default root mapping for "/" stopped working. Here's what I have...

I have this URL mapping:

"/"(controller:"IGive", action:"index" )

I have a controller named IGiveController with an index closure

def index = {
    render "foo"
}

When I go to my application running in the embedded Tomcat and Jetty with http://localhost:8080/mycontext/ I get "foo" returned property. But when I build a war and deploy to Weblogic 10.3 I get a 404.

I downgraded to Grails 1.1.2 and it still didn't work on Weblogic 10.3 but the error was more descriptive

Could not open ServletContext resource [/WEB-INF/grails-app/views/index.gsp] 

So it seems like it's completely ignoring my URL Mapping for "/" but other URL Mappings that are deeper are working. Any clues??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太阳男子 2024-08-24 16:20:34

我认为这与 Weblogic 更相关 - 我在 Weblogic 9.2 上看到了同样的情况 - 但在 Tomcat 或 Jetty 上却没有。没有击中我的 UrlMapping:

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

我认为 Weblogic 很聪明并且正在转换 / -> index.gsp 然后返回为 404。

有一个稍微丑陋的解决方法 - 只需添加一个像这样的映射:

"/index.gsp"(controller: 'home', action: 'index')   

这似乎可以解决问题。大家有更好的办法解决这个问题吗???

I think this is more related to Weblogic - I am seeing the same on Weblogic 9.2 - but not on Tomcat or Jetty. Doesn't hit my UrlMapping:

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

I think Weblogic is being smart and converting / -> index.gsp which then comes back as a 404.

There is a slightly ugly workaround - just add a mapping like this:

"/index.gsp"(controller: 'home', action: 'index')   

and that seems to do the trick. Anyone have a better way to fix this???

属性 2024-08-24 16:20:34

它可能与 Grails 1.2 的错误有关。请参阅 GRAILS-5609 和此 Grails 论坛中的线程。它已在 1.2.1 中修复。似乎 1.2 引入了 UrlMappings 的一些回归错误...

It might be related to a Grails 1.2 bug. See GRAILS-5609 and this thread in Grails forum. It is fixed in 1.2.1. It seems that 1.2 introduced some regression bugs with UrlMappings...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文