Expand my Community achievements bar.

SOLVED

Is there a way to programmatically render a Sling resource?

Avatar

Level 7

Hi,

Apart from rendering Sling resource in response to HTTP requests, is there a way to render them programatically:

protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { String output = // render "/content/foo/bar/baz.html" response.send(...); }

I am looking for an out-of-the-box solution, otherwise using an HTTP Client library it might be possible to do.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee

You can do this using SlingRequestProcessorService. Please search for this in junit cases in sling. You will find a lot of examples.

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

You can do this using SlingRequestProcessorService. Please search for this in junit cases in sling. You will find a lot of examples.