Hi Bertrand Thanks for pointing to the Planet resource provider as it clarifies quite a few things. I am almost there but still missing a few pieces.
I have setup properties on my custom resource using the value map. And I am trying to rely on the default JSON renderer servlet to render my custom resource. So for this, I have set the RESOURCE_TYPE of my resource to 'sling/servlet/default' . This setting is working fine as the ServletResolver is resolving the DefaultGetServlet for rendering this resource. But the problem that I am facing is that the DefaultGetServlet expects a 'selector' to choose the correct rendering servlet. I am accessing my resource as /path/to/my/resource.json but this is not setting the selector to 'json' . I tried to debug this a bit and found that selectors are figured out in SlingRequestPathInfo which uses the resource's 'resolutionPathInfo' property to find out the selector. For my custom resource, resolutionPathInfo is always an empty sting and hence no selector is chosen for it. I tried setting resolutionPathInfo on my custom resource through the metadata.setResolutionPathInfo. But its not getting carried over all the way through to the DefaultGetServlet. On debugging, I found that its overwritten in ResourceResolver.resolveInternal as below: // SLING-627: set the part cut off from the uriPath as // sling.resolutionPathInfo property such that // uriPath = curPath + sling.resolutionPathInfo if (resource != null) { final String rpi = absPath.substring(curPath.length()); resource.getResourceMetadata().setResolutionPath(absPath.substring(0, curPath.length())); resource.getResourceMetadata().setResolutionPathInfo(rpi); logger.debug("resolveInternal: Found resource {} with path info {} for {}", new Object[] { resource, rpi, absPath }); } Hopefully I am able to explain the problem to you correctly. I am not sure what am I missing here. Thanks for your patience. Please guide. On Thu, Jan 8, 2015 at 2:15 PM, Bertrand Delacretaz <bdelacre...@apache.org> wrote: > Hi, > > On Thu, Jan 8, 2015 at 8:19 AM, connuser1 connuser1 <connus...@gmail.com> > wrote: > > ...I am creating a SyntheticResource. How do I add properties to it?... > > The Planets resource provider example at [1] might help, I think its > json representation is what you expect. Note that it uses a > SyntheticResource only for its root, the planets themselves are custom > resources. > > -Bertrand > > [1] > http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/resourceprovider/ >