You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Juerg Meier <jc...@proxymit.net> on 2010/04/18 00:22:51 UTC

sling.include - but need output assigned to a variable

Hi all,

Calling sling.include() adds the output to the output stream of the response. 
I ran into a case, where i need to assign the output to a variable that 
serves later on as the content for an HTML email.

Code snippet
***************************************
HtmlEmail email = new HtmlEmail();
...
String html = sling.include("/a/b/c", "summary"); 	//not possible
email.setHtmlMsg(html);
....
***************************************

So, "/a/b/c" is some resource within sling, and its resourceType has 
a "summary.jsp".

Now, as sling.include() does not support this usage, the only alternative that 
comes to my mind is GETting the resource via an HTTPClient, assigning the 
outcome to the variable. But this seems to be a rather big overhead for a 
resource residing within the framework.

Any suggestions?

Thanks,
Juerg