【发布时间】:2012-03-01 18:56:11
【问题描述】:
我已将图像保存到命令对象中的 byte[] 中,并希望在 createFlow webflow 的下一阶段显示它。
我试图避免在 webflow 期间使用文件系统和/或数据库系统来存储图像。
通常,要查看图像,我会从 gsp 调用 renderImage:
class ArtefactController {
def createFlow = {
............
}
def renderImage = {
def ArtefactInstance = Artefact.findById(params.id)
if(ArtefactInstance?.image) {
response.setContentLength(ArtefactInstance.image.length)
response.outputStream.write(ArtefactInstance.image)
}
else {
response.sendError(404)
}
}
但是对于 webflow,当我尝试从 gsp 调用 renderFlowImage 时:
def renderFlowImage = {
if(flow.artefactCommand?.image) {
response.setContentLength(flow.artefactCommand.image.length)
response.outputStream.write(flow.artefactCommand.image)
}
else {
response.sendError(404)
}
}
无法访问的流范围。
有什么建议吗?
【问题讨论】:
标签: image grails scope spring-webflow