[
https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667063#action_12667063
]
Juergen Donnerstag commented on WICKET-2034:
--------------------------------------------
The call hierarchy is:
org.apache.wicket.markup.html.PackageResource.getResourceStream(boolean)
org.apache.wicket.util.resource.locator.ResourceStreamLocator.locate(Class<?>,
String, String, Locale, String)
org.apache.wicket.util.resource.locator.ResourceStreamLocator.locate(Class<?>,
String)
and locate calls first locateByResourceFinder() and if resource not found
locateByClassLoader().
locateByClassLoader() applies a search order in order to find the most
appropriate classloader, but it doesn't test multiple classloaders.
Wicket wouldn't be Wicket if there were no hook for users to enhance it. The
trick in this case is called IResourceFinder and it can be registered via
subclassing WebApplication with
protected IResourceFinder getResourceFinder()
{
return new WebApplicationPath(getServletContext());
}
Only one IResourceFinder can be registerd, but of course you can chain them
yourself if needed.
The question not yet solved though is whether locateByClassLoader() should test
multiple classloaders in order and don't stop with the first one. IMO wicket
should handle the issue raised out of the box.
> Resources refereced by HeaderContributor outside of WAR inaccessible.
> ---------------------------------------------------------------------
>
> Key: WICKET-2034
> URL: https://issues.apache.org/jira/browse/WICKET-2034
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.4-RC1
> Reporter: Maarten Billemont
>
> It appears that when referencing resources outside of the Wicket
> application's WAR using a statement such as:
> add(HeaderContributor.forJavaScript(getClass(), "foo.js")) ;
> The AS can't resolve the reference created for it.
> My scenario is the following:
> - I have a Wicket page which extends FooPage. FooPage resides in a JAR
> somewhere in the classpath, outside of the WAR. My Wicket page that extends
> FooPage is in the WAR.
> - FooPage uses the code above to add a HeaderContributor to the page.
> "foo.js" is a resource that's in the same package, and in the same JAR as
> FooPage (So also outside of the WAR).
> - When the page is rendered; the script is referenced using the URL:
> http://localhost/fooapp/resources/my.package.FooPage/foo.js
> - When I open that URL, I get the following error message from my JBoss AS:
> HTTP Status 404 - Unable to find package resource [path =
> net/link/safeonline/wicket/web/functions.js, style = null, locale = null]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.