Thanks Bertrand! >>what do you mean by "resource metadata"? I meant org.apache.sling.api.resource.ResourceMetadata as used in here: http://www.lucamasini.net/Home/sling-and-cq5/accessing-relational-data-as-sling-restful-urls I am creating a SyntheticResource. How do I add properties to it?
On Wed, Jan 7, 2015 at 4:26 PM, Bertrand Delacretaz <[email protected]> wrote: > Hi, > > On Wed, Jan 7, 2015 at 6:54 AM, connuser1 connuser1 <[email protected]> > wrote: > > I am writing a custom resource provider by implementing > > the ResourceProviderFactory interface. Currently I have sets its > 'Resource > > Type' to a path which maps to my custom servlet for rendering this > > resource. This is working perfectly but I am not really sure if this is > the > > right way to do it... > > That's what I would recommend, with a partial path as the resource > type like myapp/mything. > > >...Should I be writing my own servlet for rendering the resource or > should I > > use the sling default GET servlet?... > > If the default rendering works that's fine, and you can always add > more specific servlets or scripts later, for specific request > extensions, selectors etc. > > > ....I tried setting the resource type to sling/servlet/default but when > I make > > a GET request to the resource using the json extension, I just get the > > {"sling:resourceType":"sling/servlet/default"} in response and nothing > > else. I was expecting to see the resource metadata that I have set on > this > > resource.... > > The default json servlet outputs all resource properties, but what do > you mean by "resource metadata"? > > Note that even with a custom resource type like myapp/mything, the > default json servlet will kick in unless you provide a more specific > one. > > -Bertrand >
