Author: almaw
Date: Wed Jun 20 02:26:08 2007
New Revision: 549021

URL: http://svn.apache.org/viewvc?view=rev&rev=549021
Log:
Use ContextClassLoader to load wicket.properties.

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Initializer.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java?view=diff&rev=549021&r1=549020&r2=549021
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
 Wed Jun 20 02:26:08 2007
@@ -63,6 +63,7 @@
 import org.apache.wicket.util.convert.ConverterLocator;
 import org.apache.wicket.util.lang.Classes;
 import org.apache.wicket.util.lang.Objects;
+import org.apache.wicket.util.lang.PropertyResolver;
 import org.apache.wicket.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -585,8 +586,8 @@
                try
                {
                        // Load properties files used by all libraries
-                       final Enumeration resources = 
getClass().getClassLoader().getResources(
-                                       "wicket.properties");
+                       final Enumeration resources = 
Thread.currentThread().getContextClassLoader()
+                                       .getResources("wicket.properties");
                        while (resources.hasMoreElements())
                        {
                                InputStream in = null;
@@ -809,6 +810,9 @@
         */
        protected void internalDestroy()
        {
+               // Clear property resolver cache of Class keys.
+               PropertyResolver.destroy(this);
+               
                destroy();
                applicationKeyToApplication.remove(getApplicationKey());
        }
@@ -823,6 +827,9 @@
        {
                settingsAccessible = true;
                IPageSettings pageSettings = getPageSettings();
+               
+               // Set up the property resolver with a new cache instance for 
this app.
+               PropertyResolver.init(this);
 
                // Install default component resolvers
                pageSettings.addComponentResolver(new ParentResolver());

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Initializer.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Initializer.java?view=diff&rev=549021&r1=549020&r2=549021
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Initializer.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Initializer.java
 Wed Jun 20 02:26:08 2007
@@ -20,14 +20,13 @@
 import org.apache.wicket.markup.html.form.IFormSubmitListener;
 import org.apache.wicket.markup.html.form.IOnChangeListener;
 import org.apache.wicket.markup.html.link.ILinkListener;
-import org.apache.wicket.util.lang.PropertyResolver;
 
 /**
  * Initializer for components in wicket core library.
  * 
  * @author Jonathan Locke
  */
-public class Initializer implements IInitializer, IDestroyer
+public class Initializer implements IInitializer
 {
        /**
         * @see 
org.apache.wicket.IInitializer#init(org.apache.wicket.Application)
@@ -43,18 +42,8 @@
                IOnChangeListener.INTERFACE.register();
                IRedirectListener.INTERFACE.register();
                IResourceListener.INTERFACE.register();
-               
-               PropertyResolver.init(application);
        }
-
-       /**
-        * @see IDestroyer#destroy(org.apache.wicket.Application)
-        */
-       public void destroy(Application application)
-       {
-               PropertyResolver.destroy(application);  
-       }
-
+       
        /**
         * @see java.lang.Object#toString()
         */


Reply via email to