Martin, thanks for your feedback which I really appreciate!
Using #equals() works for ContextRelativeResource where I changed it appropriately (much nicer now).
Unfortunately #equals() will not work for PackageResource since we have to make the caching dependent on the response from the resource, not the resource itself. See for youself in the 'pub' example and the 'beer' image in wicket-examples. The same PackageResource with locale = null could result in returning 'image_en.jpg' for an English browser locale and 'image_de.jpg' for a German one.
As fas as I remember Martijn had the case that a path was requested with an empty filename (some resource path ending with '/' ) which caused loads of ugly exceptions in his log.
However the proper solution should be to not invoke the caching strategy for empty filenames at all. However a caching strategy that gets a non-empty filename and returns an empty filename has to be treated as broken and surely deserves an exception.