Grails忽略重定向并且不起作用

时间:2015-03-26 11:45:33

标签: grails redirect http-status-code-302 grails-2.4

我使用Grails 4.5。重定向根本不起作用。这是一个简单的例子。我试图重定向:

@Secured(['permitAll'])
class HomeController {

    def index() {
        println("index")
        render "index"
    }

    def one() {
        println("one")
        redirect(action: "index")
        println("two")
    }
}

当我获得:' // localhost:8080 / *** / home / one'。 Grails忽略重定向。输出是:

one
two

如果我用转发替换重定向,则必须如此:

one
index
two

我用:

build ":tomcat:7.0.52.1"
compile ":scaffolding:2.1.0"
compile ':cache:1.1.8'
runtime ":spring-security-core:2.0-RC4"
runtime ":hibernate4:4.3.5.5"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.0.2"
runtime ":resources:1.2.14"
runtime ":yui-minify-resources:0.1.5"
compile ":grails-melody:1.52.0"
compile ":barcode4j:0.3"

runtime ':twitter-bootstrap:3.3.1' // current: 3.3.1
compile ':fixtures:1.3'
compile ":webdriver:0.4.2"

spring-security的登录/注销方法也不起作用:

http://localhost:8080/***/login/index
http://localhost:8080/***/logout/index

但这很好用:

http://localhost:8080/***/j_spring_security_login

并重定向到:

http://localhost:8080/scangoods-api/login/auth

0 个答案:

没有答案