Cache resources by their URL instead of their path

Since the URLs are resolved, this simplifies making sure that one
resource referred to from different relative paths is still considered
the same resource.

This change also simplifies requestSpriteDefinition and requestImage a
little and fixes SpriteDefinition still using a hardcoded sprite path.