On 02.04.2014, at 05:51, Justin Edelson <[email protected]> wrote:
> Hi Carsten, > Just curious - why do you prefer to remove the context path from the > *result* of ResourceResolver.map() rather than removing it from the > path passed *to* ResourceResolver.map()? > > Since ResourceResolver.map() does a resolve() call, it seems to make > more sense to me that the path passed into it is the real resource > path, not the context path + resource path. I think one problem with the sling mapping is that the configuration can make an important difference: you can just do simple path mappings such as vanity paths, that are restricted to the resource tree if you will. But you can also configure domains & ports, so that mapping "/site1" will give you "http://site1.com/foo" and "/site2" will give you "http://site2.com/foo". And afaik, this can happen for the map(path) one as well - it would be an absolute URL if such a mapping is present. The map(request, path) one will do the same, but if there is no domain mapping config, it will take the schemehostport from the passed request and ensure an absolute URL is returned. As part of that you have to add the context path from that passed request. I guess if you have a mapping config with a domain, you are expected to include the right context path. That's what I know, but I don't really have an idea how to fix the issue at hand... Cheers, Alex
