2011-02-15 34 views
0

的重定向,我有這樣的:如何根據使用Grails Acegi的我index.gsp中的角色在WebLogic

<g:ifAnyGranted role="IS_AUTHENTICATED_ANONYMOUSLY"> 
    <% response.sendRedirect("login/auth"); %> 
</g:ifAnyGranted> 
<g:ifAnyGranted role="ROLE_ADMIN"> 
    <% response.sendRedirect("admin/tasks"); %> 
</g:ifAnyGranted> 
<g:ifAnyGranted role="ROLE_VIEWER_I, ROLE_VIEWER_E"> 
    <% response.sendRedirect("items/list"); %> 
</g:ifAnyGranted> 

如果我在Tomcat上運行它,這就是做工精細。

但在WebLogic 11g的一個部署後,它不工作。

你有什麼想法嗎?

非常感謝

回答

0

我會建議在控制器中,不認爲這樣做。

class SomeController { 
    def springSecurityService 
    def someAction = { 
     if (springSecurityService.isLoggedIn()) { 
     response.sendRedirect(...) 
     } 
     else { 
     response.sendRedirect(...) 
     } 
    } 
} 
+0

是的,這是我的新的實現。非常感謝。 – 2011-02-17 10:59:11

相關問題