gpt4 book ai didi

java - 页面上未找到 Wicket 图像组件

转载 作者:行者123 更新时间:2023-11-30 05:04:03 24 4
gpt4 key购买 nike

尝试显示项目列表时遇到以下问题。对于每个项目,我必须显示通过 Wicket WebResource 动态加载的图像。这些项目会在用户滚动时使用 Ajax 滚动逐步加载(一次加载 50 个)。

[ERROR] 2011-04-19 09:58:18,000 btpool0-1 org.apache.wicket.RequestCycle.logRuntimeException (host=, request=, site=): org.apache.wicket.WicketRuntimeException: component documentList:scroller:batchElem:666:content:item:3:batchItemContent:linkToPreview:imageThumbnail not found on page com.webapp.document.pages.DocumentListPage[id = 1] listener interface = [RequestListenerInterface name=IResourceListener, method=public abstract void org.apache.wicket.IResourceListener.onResourceRequested()]

org.apache.wicket.protocol.http.request.InvalidUrlException: org.apache.wicket.WicketRuntimeException: component documentList:scroller:batchElem:666:content:item:3:batchItemContent:linkToPreview:imageThumbnail not found on page com.webapp.document.pages.DocumentListPage[id = 1] listener interface = [RequestListenerInterface name=IResourceListener, method=public abstract void org.apache.wicket.IResourceListener.onResourceRequested()] 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) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479) at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByGuice$$51619816.CGLIB$doGet$6() at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByGuice$$51619816$$FastClassByGuice$$6d42bf5d.invoke() at com.google.inject.internal.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64) at com.freiheit.monitoring.PerformanceMonitoringMethodInterceptor.invoke(PerformanceMonitoringMethodInterceptor.java:115) at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64) at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44) at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByGuice$$51619816.doGet() at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312) at org.apache.wicket.protocol.http.WicketFilter$$EnhancerByGuice$$51619816.CGLIB$doFilter$4()

如何解决这个问题?

以下是负责添加图像的代码部分:

previewLink.add(createThumbnailSmall("imageThumbnail", documentModel));

createThumbnailSmall(final String id, final IModel<BaseDocument> documentModel) {
// thumbnailResource is an object that contains the path of the image

if (thumbnailResource != null) {
final WebResource resource = getWebResource(thumbnailResource);
final Image image = new Image(id, resource);
return image;
}
return new InvisibleContainer(id);
}

WebResource getWebResource(final DocumentResource documentResource) {
return new WebResource() {

private static final long serialVersionUID = 1L;

@Override
public IResourceStream getResourceStream() {
return new BaseStreamResource(documentResource);
}
};
}

其中 BaseStreamResource 如下:

public class BaseStreamResource extends AbstractResourceStream {
private InputStream _fileInputStream = null;
private DocumentResource _resource = null;

public BaseStreamResource(final DocumentResource documentResource) {
_resource = documentResource;
}

@Override
public InputStream getInputStream() throws ResourceStreamNotFoundException {
if (_fileInputStream == null) {
try {
if (_resource == null) {
throw new ResourceStreamNotFoundException("Resource was null");
}
_fileInputStream = _resource.getFileInputStream();
} catch (final ResourceNotAvailableException ex) {
throw new ResourceStreamNotFoundException(ex);
}
}
return _fileInputStream;
}

在 HTML 中:

<a wicket:id="linkToPreview" href="#">
<img wicket:id="imageThumbnail" alt="Attachment"></img></a>

最佳答案

添加的代码并没有真正为我添加任何线索,但也许我可以帮助缩小范围。

堆栈跟踪包含对 com.webapp.document.pages.DocumentListPage 的引用,它可能调用您发布的一些代码。该错误表明 url 错误,因此调试该类、添加调试打印以及查看包含 url 的任何字段的值可能是值得的。

它甚至可能有助于修改 DocumentListPage 中的代码(可能暂时用于调试)以捕获 org.apache.wicket.protocol.http.request.InvalidUrlException 并添加当捕获异常时,调试会专门打印。

这并不是真正的答案,但对于评论来说太大了,也许它会帮助您更接近答案。

关于java - 页面上未找到 Wicket 图像组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5714229/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com