Locating resources can take a significant amount of time, especially since there are often
several CSS, JavaScript and image resources on any given page. To facilitate localization and
styling, Wicket will usually make several attempts at locating each resource (i.e. first with an
"en_US" suffix, then "en", and so on); multiply these attempts by the number of resources on the
page and this starts to add up.

This locator mitigates this problem by caching (indefinitely) references to
UrlResourceStream and FileResourceStream objects as they are found, and
NullResourceStreamReference for all which are missing so they are not looked up again and
again.

Method Detail

locate

Locate a resource, given a path and class. Typically this method is either called by external
clients if they are not interested in a lookup that takes the style and locale into account,
or it is called by the implementation of
IResourceStreamLocator.locate(Class, String, String, String, java.util.Locale, String, boolean) where the
latter just takes care of trying out the different combinations for the provided style and
locale and uses this method to actually load the resource stream.
Checks for IResourceStreamReference in the cache and returns null if the
result is NullResourceStreamReference.INSTANCE, or FileResourceStream /
UrlResourceStream if there is an entry in the cache. Otherwise asks the delegate to
find one and puts it in the cache.

Markup resources and Properties files both need to iterate over different combinations of
locale, style, etc.. And though no single locate(..) method exists which is used by both,
they both use ResourceNameIterators.