You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Maarten Billemont (JIRA)" <ji...@apache.org> on 2009/01/21 15:37:59 UTC

[jira] Created: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

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.


[jira] Resolved: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2034.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

> 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
>            Assignee: Igor Vaynberg
>
> 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Maarten Billemont (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667001#action_12667001 ] 

Maarten Billemont commented on WICKET-2034:
-------------------------------------------

Shouldn't getClass().getClassloader() return the classloader that knows about the resources in the class' package, such as function.js?

> 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666985#action_12666985 ] 

Juergen Donnerstag commented on WICKET-2034:
--------------------------------------------

How is net/link/safeonline/wicket/web/functions.js linked with foo.js???

Does enabling debug messaging on org.apache.wicket.resource yield anything?

> 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667022#action_12667022 ] 

Igor Vaynberg commented on WICKET-2034:
---------------------------------------

that class is used as scope, but i am not sure its classloader is used...

> 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666996#action_12666996 ] 

Igor Vaynberg commented on WICKET-2034:
---------------------------------------

if it is outside the war it might be handled by a different classloader then the one that loaded wicket - in which case there is not much we can do because only the classloader that loaded FooPage.class can see function.js next to it.

> 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676058#action_12676058 ] 

Juergen Donnerstag commented on WICKET-2034:
--------------------------------------------

applied a patch that Wicket will not test the classloaders in the following order:

		if (clazz != null)
		{
			resourceStream = getResourceStream(clazz.getClassLoader(), path);
			if (resourceStream != null)
			{
				return resourceStream;
			}
		}

		// use context classloader when no specific classloader is set
		// (package resources for instance)
		resourceStream = getResourceStream(Thread.currentThread().getContextClassLoader(), path);
		if (resourceStream != null)
		{
			return resourceStream;
		}

		// use Wicket classloader when no specific classloader is set
		return getResourceStream(getClass().getClassLoader(), path);


> 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.


[jira] Commented: (WICKET-2034) Resources refereced by HeaderContributor outside of WAR inaccessible.

Posted by "Maarten Billemont (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666991#action_12666991 ] 

Maarten Billemont commented on WICKET-2034:
-------------------------------------------

Er; foo.js in my example is functions.js.

replace net/link/safeonline/wicket/web/functions.js by my/package/foo.js

> 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.