Grails,Weblogic和根目录重定向“/”似乎不工作 [英] Grails, Weblogic and redirection on root "/" seems not working
本文介绍了Grails,Weblogic和根目录重定向“/”似乎不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
/{
controller =mycontroller
action =myaction
}
in mycontroller.myaction,这取决于作用的,我重定向到正确的行动:
DEF链路
如果(SpringSecurityUtils。 ifAnyGranted( ROLE_ADMIN)链接= g.createLink(动作: 动作1,控制器: 控制器)
,否则如果(SpringSecurityUtils.ifAnyGranted( ROLE_ADMIN)链接= g.createLink(动作: 动作2 ,控制器:控制器)
其他...匿名... {
link = g.creatLink(action:public,controller:mycontroller)
}
重定向(url:link)
使用嵌入式grails服务器,它工作正常,但使用 weblogic 它重定向index.gsp。
为什么?
你有什么想法吗?
谢谢
解决方
我发现溶液这里
- 我创建了一个taglib。
- 我重命名在$ B $ /,以 /重定向 B urlMapping中
- 我请在GSP的taglib的映射。
I configured my grails application with an root path like this (in UrlMapping):
"/"{
controller="mycontroller"
action="myaction"
}
in mycontroller.myaction, depending of the role, I redirect to the right action :
def link
if (SpringSecurityUtils.ifAnyGranted("ROLE_ADMIN") link = g.createLink(action: "action1", controller:"controller")
else if (SpringSecurityUtils.ifAnyGranted("ROLE_ADMIN") link = g.createLink(action: "action2", controller:"controller")
else ...ANONYMOUS... {
link = g.creatLink(action:"public", controller:"mycontroller")
}
redirect (url:link)
With embedded grails server, it's working fine but with weblogic it redirect on the index.gsp.
Why ?
Do you have an idea ?
Thanks
解决方案
I found the solution here
- I created a taglib.
- I rename the mapping on "/" to "/redirect" in UrlMapping
- I call the taglib in GSP.
这篇关于Grails,Weblogic和根目录重定向“/”似乎不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文