Grails - 先前的重定向呼叫(..)已重定向 [英] Grails - A previous call to redirect(..) has already redirected

查看:173
本文介绍了Grails - 先前的重定向呼叫(..)已重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Grails应用程序中,偶尔会在日志中看到无法发出重定向:
$ b 2011-04-27 12:18:40,469 [TP-Processor13]错误GrailsExceptionResolver - 在这里不能发出重定向(..)。之前调用重定向(..)已经重定向了响应。
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException:无法在此处发出重定向(..)。之前调用重定向(..)已经重定向了响应。
在com.coach.LoginController $ _closure2.doCall(LoginController.groovy:90)
...



不知道如何跟踪这个。任何想法或建议?



Todd

解决方案

检查登录控制器;好像你没有从重定向后的动作中返回。 ::

  if(some condition){
redirect()
return //应该从这里返回来完成动作,否则其余的代码将被执行
}


In Grails app, occasionally seeing "Cannot issue redirect" in logs:

2011-04-27 12:18:40,469 [TP-Processor13] ERROR GrailsExceptionResolver - Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response. org.codehaus.groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException: Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response. at com.coach.LoginController$_closure2.doCall(LoginController.groovy:90) ...

Not sure how to track this down. Any ideas or suggestions?

Todd

解决方案

Check the login controller; it seems like you are not returning from the action after redirect. E.g.:

if (some condition) {
    redirect ()
    return  // should return from here to finish the action, otherwise the rest of the code will be executed
}

这篇关于Grails - 先前的重定向呼叫(..)已重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆