Java Tapestry动态生成图像
我的Tapestry5应用程序每天使用jFreeChart动态生成图像。 我的问题是我不知道如何表现 我试图将它们保存到webapp文件夹中,但似乎不可能,因为里面没有创建任何文件 我尝试了一个带有StreamResponse的解决方案,但没有结果 另一个是关于IEngineService的,但似乎只适用于T4 所以,我希望能得到一些帮助。Java Tapestry动态生成图像,java,jfreechart,tapestry,Java,Jfreechart,Tapestry,我的Tapestry5应用程序每天使用jFreeChart动态生成图像。 我的问题是我不知道如何表现 我试图将它们保存到webapp文件夹中,但似乎不可能,因为里面没有创建任何文件 我尝试了一个带有StreamResponse的解决方案,但没有结果 另一个是关于IEngineService的,但似乎只适用于T4 所以,我希望能得到一些帮助。 谢谢。好的,我找到问题所在,这里是解决方案,对于其他类,请参阅 public StreamResponse onImage() { StreamRe
谢谢。好的,我找到问题所在,这里是解决方案,对于其他类,请参阅
public StreamResponse onImage() {
StreamResponse result = null;
if (graphic != null && graphic.getImage() != null) {
try {
InputStream input = new FileInputStream(graphic.getImage());
result = new PngInline(input, "test");
} catch (FileNotFoundException e) {
logger.error("Loading graphic image", e);
}
}
return result;
}
@Inject
private ComponentResources resources;
public Link getLink() {
return resources.createEventLink("image", new Object[]{});
}