【问题标题】:Resource plugin not rendering correctly with https资源插件无法使用 https 正确呈现
【发布时间】:2012-11-09 20:18:19
【问题描述】:

我正在尝试使用 groovyPageRenderer.render() 来渲染带有模型的寺庙,以便我可以使用 sendMail {} 通过电子邮件发送渲染的 HTML。我们拥有的一些横幅包含图像,我们使用以下方式添加它们:

${resource(dir: 'images/email', file: 'background_body.gif', absolute: true)}

这一切都很好,并且在开发中运行良好。但是,我们希望通过 https 运行应用程序,尽管将 grails.serverURL 设置为“https://ourwebsite.com”(如 ApplicationTagLib.groovy 中的 Closure 资源文档所示 [来自 grails-plugin-gsp]) ,它仍然尝试通过http(不可用)将资源呈现为可用,仅通过https。

【问题讨论】:

    标签: email grails


    【解决方案1】:

    基于资源插件源中的this comment,插件的resource() 标记似乎不能正确支持attr absolute。如果您运行的是 Grails v2.0 或更高版本,Grails 的LinkGenerator 可能是一种解决方法。它被注入为grailsLinkGenerator,可以这样调用:grailsLinkGenerator.resource(dir: '...', file: '...', absolute: true)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2018-04-16
      • 2016-02-14
      • 2014-03-19
      • 2015-03-18
      • 1970-01-01
      相关资源
      最近更新 更多