Hi,

I'm implementing a Wicket application that has heavy use of styling and localization. I want to place the resources for these styles and locales in an external directory structure (not in the war). Basically, I want the following structure:

/external/<style>/<locale>/images
/external/<style>/<locale>/css
/external/<style>/<locale>/messages.properties
/external/<style>/<locale>/templates

The reason I want all these files externally is because I want to be able to add and modify these files while the application is running. I also want the directory structure like this because it's basically branding and I want to easily be able to restrict access to the subtree under /external/brand1 (using for example ftp or webdav) to a specific person responsible for that tree.

I also want to use the standard fallback mechanism, so if I look for a css file called my.css with style style1 and locale locale1, I want to try:

1. /external/style1/locale1/css/my.css
2. /external/_default/locale1/css/my.css
3. /external/style1/_default/css/my.css
4. /external/_default/_default/css/my.css
5. Wicket's standard mechanism for finding my.css

Question 1:
- how can I add this scheme to the resource locating mechanism?

I looked into IResourceStreamLocator and IResourceSettings, and what I can think of is writing my own IResourceStreamLocator which wraps Wicket's implementation, does 1-4 and if nothing is found calls Wicket's implementation.

However, there is a class ResourceNameIterator which immplements the locale/style sequence of finding pathnames, and it used not only in ResourceStreamLocator, but also in all the IStringResourceLoaders. This leads me to believe that I must also add my own IStringResourceLoader to look in the property files above. I'm also wondering how I can do this efficiently though: how can I make sure I don't have to read the property files 100 times for message keys (once for each key)? Do I have to implement my own caching in the IStringResourceLoader implementation? Is there anything I can reuse from Wicket which already reads property files for keys.

Question 2:
- Some of the resources listed above are public, and I want to be able to mount them. Is it possible to mount an entire directory at a time, e.g., mount /images and then automatically have http://www.mywicketapplication.com/app/images/xxxx.jpg use my resource loader with the path "images/xxxx.jpg"?

Question 3:
- Are there any tips with regards to Wicket's caching mechanism and my desire to be able to change resources on the fly (I'm especially concerned about negative caching (i.e., resource was not found before, but now it has been added), and new resources appearing for a more specific style/locale, overriding the previously more generic resource (i.e., style1/_default/my.css was previously found, but now style1/nl/my.css suddenly exists and should be used instead))?


Regards,
Sebastiaan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to