Hi Carsten,

so I followed the proposal and moved the resource mapping
SPI "resolve hook-in point" before authentication (in
sling engine) - see [1]. This will mean that once the
path mappings are migrated to the SPI, the authentication
requirements can be evaluated after the mapping.

The Sling API part is quite mature, ResourceUri has quite
intensive test coverage now [2]. ResourceUriMapper [3] is
the SPI interface (not called ResourceToUriMapper anymore
because the SPI interface is actually taking ResourceUri
as both input and output). The service calls all
ResourceUriMappers is now called PathToUriMappingService [4]
(was called ResourceUriMappingChain, now closer to your
proposal PathRewriter). This service is part of the API
now to allow to use is from the sling engine bundle.

The parts in resourceresolver and sling engine work well
with the sling starter (Slingshot, Composum) but will need
a bit of more testing...

-Georg

[1]
https://github.com/apache/sling-org-apache-sling-api/commits/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2
https://github.com/apache/sling-org-apache-sling-api/commit/c27db47a07ce7d85896e1c761f462653a7532e79

https://github.com/apache/sling-org-apache-sling-resourceresolver/commits/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2
https://github.com/apache/sling-org-apache-sling-resourceresolver/commit/de835ae65bc4e8b5b6955ee5e679706e0e0a2adf

https://github.com/apache/sling-org-apache-sling-engine/commits/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2
https://github.com/apache/sling-org-apache-sling-engine/commit/203f9a85a101749c070ea8c3d76ef194c8056b73

[2]
https://github.com/apache/sling-org-apache-sling-api/blob/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2/src/test/java/org/apache/sling/api/resource/uri/ResourceUriTest.java

[3]
https://github.com/apache/sling-org-apache-sling-api/blob/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2/src/main/java/org/apache/sling/spi/resource/mapping/ResourceUriMapper.java

[4]
https://github.com/apache/sling-org-apache-sling-api/blob/feature/SLING-9662-Introduce-Resource-Mapping-SPI-v2/src/main/java/org/apache/sling/api/resource/mapping/PathToUriMappingService.java


On 2020-09-04 07:09, Carsten Ziegeler wrote:
Hi Georg,


One question though:

PathRewriterFactory
So this class is currently called ResourceUriMappingChain and it is
*not* a factory - it is a regular OSG service that does not hold
any state as member variables - did you have a particular reason in
mind why it should be a factory or was this just following the
pattern from the ResourceResolver?
I wanted to have a factory that allows to create a PathRewriter which
contains a servlet request - this way such a PathRewriter can be
created for every incoming request as a first step and then simply be
passed - in my case to the ResourceResolverFactory and then the
ResourceResolver.
This way if you use the PathRewriter from the ResourceResolver it
already has the right context (request).

I thought it might be useful to manage some state (request in this
case) on the PathRewriter.

Regards
Carsten

--
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org

Reply via email to