Sling Model question on ResourcePath | Community
Skip to main content
jason_tarry
Level 2
October 16, 2015
Solved

Sling Model question on ResourcePath

  • October 16, 2015
  • 1 reply
  • 766 views

Hi all,

I'm trying to figure out if there is a convenient way to Inject a Resource from a given path. There is the option of using a ResourceResolver but from reading Justin's slides it looks like it might possible to do something like this:

    @Inject @ResourcePath(path="/path/to/resource")

    Resource resource;

 

It doesn't seem to work for me so I just wanted to check if this is possible. Has anyone done something like this?

Regards,

Jason

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

Try with Resource.getResource();

1 reply

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
Level 10
October 16, 2015

Try with Resource.getResource();