使用 Wicket 1.5 提供动态内容
我有我的 Wicket 1.4 代码,其中包含下载以编程方式生成的文件的链接:
protected class MyWebResource extends WebResource {
public IResourceStream getResourceStream() {
.....
return new StringResourceStream(myString, "text/plain");
}
}
ResourceLink<?> downloadLink =
new ResourceLink<Object>("downloadLink", new MyWebResource());
一切都很好。现在我已经升级到 Wicket 1.5。现在 WebResource
不再存在。
我在网上搜索了很长时间,这肯定是一个简单的问题,有一个简单的解决方案吗?唉我找不到它。
I have my Wicket 1.4 code to have a link to download a file which is generated programatically:
protected class MyWebResource extends WebResource {
public IResourceStream getResourceStream() {
.....
return new StringResourceStream(myString, "text/plain");
}
}
ResourceLink<?> downloadLink =
new ResourceLink<Object>("downloadLink", new MyWebResource());
Everything was good. Now I've upgrade to Wicket 1.5. Now WebResource
doesn't exist any more.
I've searched the web for ages, surely this must be a simple problem which has a simple solution? Alas I can't find it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
替代品是 AbstractResource。基本上,您应该创建 ResourceResponse 并执行您在 WriteCallback 中所做的操作。
请参阅 Wicket 代码中 AbstractResource 的专业化示例。
请参阅http://wicketinaction.com/2011/07/wicket-1 -5-mounting-resources/ 也是如此。
The replacement is AbstractResource. Basically you should create ResourceResponse and do what you did in its WriteCallback.
See the specializations of AbstractResource in Wicket's code for examples.
See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ as well.