Expand my Community achievements bar.

SOLVED

Sling Model question on ResourcePath

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

Try with Resource.getResource();

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Try with Resource.getResource();