Is there a way to programmatically render a Sling resource? | Community
Skip to main content
LinearGradient
New Participant
October 16, 2015
Solved

Is there a way to programmatically render a Sling resource?

  • October 16, 2015
  • 1 reply
  • 909 views

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.
Best answer by gopalKa

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

1 reply

gopalKaAccepted solution
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.