Skip to main content
LinearGradient
Level 6
October 16, 2015
Solved

Is there a way to programmatically render a Sling resource?

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
gopalKaAccepted solution
Adobe Employee
October 16, 2015

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

1 reply

gopalKaAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

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

Translate