【发布时间】:2012-10-22 20:41:20
【问题描述】:
我必须将 swf 文件列表保存在本地系统的本地目录中,而不是项目文件夹中。
我必须使用其名称从该路径调用 swf 文件,并将其显示在 liferay 6.1 中的 vaadin portlet 的浏览器中。
谁能分享一下如何实现这一点的想法?
提前致谢
【问题讨论】:
我必须将 swf 文件列表保存在本地系统的本地目录中,而不是项目文件夹中。
我必须使用其名称从该路径调用 swf 文件,并将其显示在 liferay 6.1 中的 vaadin portlet 的浏览器中。
谁能分享一下如何实现这一点的想法?
提前致谢
【问题讨论】:
为此,您必须使用 Stream Resource .. 只需检查以下示例代码..
祝您签证顺利:)
Window window = new Window();
setMainWindow(window);
Label label = new Label("Embed tag");
label.setDebugId("lblMsg");
window.addComponent(label);
StreamSource s = new StreamResource.StreamSource() {
@Override
public InputStream getStream() {
File f = new File("C:/test/test.swf");
FileInputStream fis=null;
try {
fis = new FileInputStream(f);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return fis;
}
};
StreamResource r = new StreamResource(s,"application/x-shockwave- flash",getMainWindow().getApplication());
Embedded e = new Embedded();
e.setType(Embedded.TYPE_OBJECT);
e.setMimeType("application/x-shockwave-flash");
e.setSource(r);
e.setWidth("400px");
e.setHeight("400px");
window.addComponent(e);
【讨论】: