Details
Description
Automatic linking seems to be broken when used in conjunction with base classes and referencing relative images located in a different package.
The attached quickstart application contains a base page wicket.bugs.autolink.page.base.BasePage whose HTML references an image located at <BasePage Package>/theme/logo.png: <img src="theme/logo.png" ...>
When accessing this page via http://localhost:8080/base the image is rendered as expected.
The application contains a second page wicket.bugs.autolink.page.home.HomePage extending the BasePage and that adds a second reference to this image via <img src="../base/theme/logo.png" ...> => this kind of references used to work in Wicket 1.4
When accessing this page via http://localhost:8080/home none of the two images (the one inherited from the base page and the one added) is displayed.
The inherited image reference is rendered as:
<img src="theme/logo.png" border="1" onclick="window.location.href='theme/logo.png';return false;"/>
=> theme/logo.png seems not to be an auto link
=> I have no idea why an onclick event is rendered by Wicket
and the explicitly added image reference is rendered as
<img src="wicket/resource/wicket.bugs.autolink.page.home.HomePage/../base/theme/logo-ver-1318516450215.png" />
=> accessing the URL http://localhot:8080/wicket/resource/wicket.bugs.autolink.page.home.HomePage/../base/theme/logo-ver-1318516450215.png results in:
WARN - WicketObjects - Could not resolve class [base]
java.lang.ClassNotFoundException: base
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:424)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:377)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.apache.wicket.application.AbstractClassResolver.resolveClass(AbstractClassResolver.java:110)
at org.apache.wicket.util.lang.WicketObjects.resolveClass(WicketObjects.java:68)
at org.apache.wicket.request.mapper.BasicResourceReferenceMapper.resolveClass(BasicResourceReferenceMapper.java:143)
at org.apache.wicket.request.mapper.BasicResourceReferenceMapper.mapRequest(BasicResourceReferenceMapper.java:120)
at org.apache.wicket.request.mapper.ParentPathReferenceRewriter.mapRequest(ParentPathReferenceRewriter.java:83)
at org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:130)
at org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:179)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:204)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:251)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)