[ 
https://issues.apache.org/jira/browse/WICKET-3907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13065975#comment-13065975
 ] 

Martin Grigorov commented on WICKET-3907:
-----------------------------------------

That's the reason getCompatibilityScore() to not be final.
You want to mount on the same path and the used Mappers conflict.
The solution is to extend ResourceMapper and override its 
getCompatibilityScore() to return higher value than the other mapper.

Makes sense ?

> Mounted resources sharing a parent URL with mounted pages makes wicket log 
> warnings for valid resources
> -------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-3907
>                 URL: https://issues.apache.org/jira/browse/WICKET-3907
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC5.1
>            Reporter: Adriano dos Santos Fernandes
>
> Say you mount a resource (ResourceMapper) in /test/nonClassName and mount a 
> package (MountMapper) in /test.
> When you try to access /test/nonClassName, wicket tries the MountMapper (as 
> its compatibility score is higher) and tries to load the class nonClassName.
> Here are the relevant code paths:
> AbstractClassResolver:
> // synchronize on the only class member to load only one class at a time and
> // prevent LinkageError. See above for more info
> synchronized (classes)
> {
>       clazz = Class.forName(className, false, getClassLoader());
>       if (clazz == null)
>       {
>               throw new ClassNotFoundException(className);
>       }
> }
> classes.put(className, new WeakReference<Class<?>>(clazz));
> WicketObjects:
> public static <T> Class<T> resolveClass(final String className)
> {
>       Class<T> resolved = null;
>       try
>       {
>               if (Application.exists())
>               {
>                       resolved = (Class<T>)Application.get()
>                               .getApplicationSettings()
>                               .getClassResolver()
>                               .resolveClass(className);
>               }
>               if (resolved == null)
>               {
>                       resolved = (Class<T>)Class.forName(className, false, 
> Thread.currentThread()
>                               .getContextClassLoader());
>               }
>       }
>       catch (ClassNotFoundException cnfx)
>       {
>               log.warn("Could not resolve class [" + className + "]", cnfx);
>       }
>       return resolved;
> }
> ResourceMapper:
> public int getCompatibilityScore(Request request)
> {
>       return 0; // pages always have priority over resources
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to