我已将图像保存到命令对象中的一个字节[],并希望在createFlow webflow的下一个阶段显示它。Grails Webflow显示图像 - 流程范围
我试图避免在webflow期间使用文件系统和/或数据库系统来存储图像。然而
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:
典型地,观看图像,我称renderImage从GSP
def renderFlowImage = {
if(flow.artefactCommand?.image) {
response.setContentLength(flow.artefactCommand.image.length)
response.outputStream.write(flow.artefactCommand.image)
}
else {
response.sendError(404)
}
}
流量范围不可访问。
有什么建议吗?
感谢您的回应,这很好。 您是否知道我将如何解决flowExecutionKey的解决方法? – user898100
对于解决方法,我想你可能会适应以下文章中描述的技术:http://bit.ly/8NnO8v和http://bit.ly/9ApKP7。但是我个人不想用仅仅致力于渲染图像的步骤来污染我的流量。你也可以看看“Ajaxflow”插件。 –