2011-04-20 42 views
2

我试图使用Wicket WebResource动态地同时加载大量图像。问题是,它需要大量的时间来加载它们,并在某些情况下,花费超过一分钟,然后我收到以下错误:如何在Wicket中动态快速加载图像?

org.apache.wicket.protocol.http.request.InvalidUrlException: org.apache.wicket.WicketRuntimeException: After 1 minute the Pagemap null is still locked by: Thread[http-8443-2,5,main], giving up trying to get the page for path: 6:documentList:scroller:batchElem:11:content:item:7:cols:9:batchItemContent:linkToPreview:imageThumbnail
at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:262)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)

有谁知道其他的解决方案,以动态地加载图像,为了避免错误?

+0

可能相关:http://stackoverflow.com/questions/5714229/wicket-image-component-not-found-on-page – Pops 2011-04-20 14:26:21

回答

0

您可以将每个图像放在一个AjaxLazyLoadPanel中,然后每个图像都会为服务器创建很多短的请求。

0

The problem is that it takes a lot of time to load them, and in some cases it takes more than a minute

您当然应该尝试让负载花费不到一分钟的时间,因此您不会得到页面映射锁异常,并且不会让用户等待。

可以延长超时时间(请参阅this question),但这不是最佳解决方案。

什么花这么多时间?你在做复杂的动态图像渲染吗?你能显示代码吗?

您可能已经意识到了这一点,但有image examples可能有用。

0

更好地使用Wicket共享资源来传送图像内容。 也就是说例如:MyApp#init()中的 安装资源 - mountSharedResource()为1.4或mountResource()为1.5。 然后使用ContextImage和指向挂载的资源+动态参数的图像名称/路径的url。 好处是Wicket共享资源不会与Wicket Pages同步。