can't we call the class resolver? for this? OSGI is supposed to implement this and then the defaults are also better
johan On 6/20/07, Al Maw <[EMAIL PROTECTED]> wrote:
Jan Vermeulen wrote: > So my question is now: is that 'wicket.properties' file meant to be a > resource that's always within the Wicket 'bundle' ? If so, would it not be > better to use the latter code to lookup resources, so that it works in > environments with multiple classloaders ? Yes, it will always be packaged in the Wicket JAR file, at any rate. What this means in an OSGI environment I'm afraid I don't know. ;-) > And if it's not that evident where the 'wicket.properties' file should > reside, don't you need some utility method for resource loading that tries > out different classloaders ? Something like: > > public static URL loadResource(String path) throws ClassNotFoundException { > try { > return > (Thread.currentThread().getContextClassLoader().getResource(path)); > } catch (ClassNotFoundException e) { > return (getClass().getClassLoader().getResource(path)); > } > } > > Jan. > Yep, absolutely. I've updated it to use the Thread's contextClassLoader, which I think should be sufficient, no? I've also updated things so that we don't run the PropertyResolver init/destroy code in the Initializer, but instead in internalInit() and internalDestroy(), as it seems a better place for it to live. Al -- Alastair Maw Wicket-biased blog at http://herebebeasties.com