On 18.05.11 19:45, "davidjgonzalez" <[email protected]> wrote: >How can I get either a valid SlingRepository object or JCRSession from >within a standard Java class? > >This Java Class may not have access to a SlingHttpRequest object. The JCR >Session would need to be that of the admin instance. > >Can someone provide a short code snippet or point me to documenation on >how >to do this?
I think this question is rather something for the sling users mailing list. To give a short answer: in Sling, you'd typically have a OSGi component or service for such a background (non-request-handling) use case, which can use SCR annotations to get a reference to the SlingRepository service: @Reference private SlingRepository repository; Regards, Alex -- Alexander Klimetschek Developer // Adobe (Day) // Berlin - Basel
