Thanks Stefan for your reply! I tried with @ChildResource and it worked like a charm - cool!
As far as I understand the @ResourcePath javadoc, you can use this annotation to inject a resource by given path, but not a relative path. On Wed, Apr 20, 2016 at 5:38 PM, Stefan Seifert <[email protected]> wrote: > @ResourcePath injects the resource path (string), not a resource > identified by a path. > > please try the @ChildResource injector with name = child path. > > https://sling.apache.org/documentation/bundles/models.html#available-injectors > > stefan > > >-----Original Message----- > >From: olimination [mailto:[email protected]] > >Sent: Wednesday, April 20, 2016 5:19 PM > >To: [email protected] > >Subject: Sling Models: ResourcePath annotation with relative path support? > > > >Hi, > > > >I'm using Sling Models (cool stuff, thanks for that!) and would like to > get > >a resource relative to the current rendered resource. Actually I want to > >get an InputStream from a nt:file node and so I thought to make this with > >the ResourcePath annotation with a relative path. > > > >Something like: > > > >@ResourcePath(path = "mynode/jcr:content") > >private InputStream myfile; > > > >but this seems not to be supported or maybe I missed some documentation > how > >to do it? > > > >Alternatively I can use @Self and the navigate and adapt it to an > >InputStream. > > > >But I thought maybe there is a possibility to use the @ResourcePath > >annotation with a relative path. > > > > > >Thanks for help! > >Oli > -- ======================= (C)olimination.com
