@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:oliminat...@gmail.com] >Sent: Wednesday, April 20, 2016 5:19 PM >To: users@sling.apache.org >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