Hi,

I am trying to implement a custom ResourceProvider and return a resource that 
can be adapted to a ValueMap and eventually be rendered by JsonRendererServlet.

The request will be /etc/myroot/myresource.json.
I implemented the resource provider the following way:

-        It returns a resource for path /etc/myroot/myresource.json

-        The resource has the following properties:

o   resourcePath = /etc/myroot/myresource

o   metadata.resourcePath = /etc/myroot/myresource

o   metadata.resourcePathInfo = .json

However that does not work because the ResourceProvider overrides the 
metadata.resourcePath in [1] to the full requestPath, and 
metdata.requestPathInfo to the remainder of the path (the empty string).

Does that mean that in a ResourceProvider one should only return the resource 
for the exact resource path /etc/myroot/myresource and ignore paths with 
additional info?
Another way would be to trick the ResourceResolver and always return a new 
metadata object, hence making the ResourceResolver overrides non effective.

What is the correct way to implement the resource provider?

Thanks,
Marius


[1] 
https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java?source=cc#L935
[2] 
https://github.com/apache/sling/blob/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java?source=cc#L803


Reply via email to