grails应用程序重定向到以前的DNS

时间:2014-02-04 14:44:57

标签: grails redirect

此处的管理员将grails应用程序移动到新子网并更改了DNS。然而,我的应用程序继续重定向并创建到以前的子网/ DNS的链接。我搜索了我的项目是否使用了旧的DNS而没有任何命中。

这就是重定向逻辑的样子:

withFormat {
        // Browsers re-direct to prevent multi-submit issues, the others just get the data of the created Evaluation
        html {
            flash.message = message(code: 'default.created.message', args: [message(code: 'evaluation.label', default: 'Evaluation'), evaluationInstance.id])
            flash.messageType = "success"
            redirect(
                    mapping: "restChild",
                    params: [
                            parent:'performanceReview',
                            parentId: evaluationInstance.performanceReview.id,
                            id: evaluationInstance.id
                    ]
            )
        }
        json {
            response.status = 201
            response.setHeader("Location", createLink(mapping: "restEntity", absolute: true, id: evaluationInstance.id).toString())
            forward(action: "show", id: evaluationInstance.id)
        }
        xml {
            response.status = 201
            response.setHeader("Location", createLink(mapping: "restEntity", absolute: true, id: evaluationInstance.id).toString())
            forward(action: "show", id: evaluationInstance.id)
        }
    }

这是conf / URLMappings.groovy文件

// RESTful entity mapping
name restEntity: "/$controller/$id"(parseRequest: true) {
    action = [GET: "show", PUT: "update", POST: "update", DELETE: "delete"]
    constraints {
        id matches: /\d+/
    }
}

我的问题是,我希望在哪里修复重定向的域名?

1 个答案:

答案 0 :(得分:1)

这通常由grails.serverURL(或外部配置文件)中的grails-app/conf/Config.groovy配置设置控制

以这种方式生成链接时使用grails.serverURL中设置的基本网址值:createLink(... absolute: true)Link to reference docs