Could we have a helper method/service here as well? Not just for JSPs but for
java code as well.
It's a common question that people want to render a request result into a
string (or simply get the stream; internally a bytearrayoutputstream probably),
and the answer "yes, you can do that, just build your own dummy
request/response wrappers and place your own outputstream in there" is a bit
difficult.
Two recent examples that could make use of that in Sling:
- Bertrand's health check which does script execution:
http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/healthcheck/hc-sling/src/main/java/org/apache/sling/hc/sling/impl/HttpResponse.java
(see javadoc)
- web resources (from SLING-2805) that allow for compilers to be written as
sling script engines (ok, that's just an idea)
Cheers,
Alex
On 19.04.2013, at 16:45, Felix Meschberger wrote:
> Hi Mike
>
> I agree, that this would be a nice addition. I don't think this is too
> hard to implement, basically all it takes is wrap the response and
> overwrite the getWriter method to capture the output in a StringBuilder
> which can then be pumped into the variable or StringReader.
>
> Would you be able to come up with a patch ?
>
> Regards
> Felix
>
> On 19.04.13 13:55, "mjkelleher" wrote:
>
>> Hello,
>>
>> Posted a new feature request:
>> https://issues.apache.org/jira/browse/SLING-2834
>>
>> Some of the standard EE taglibs support this feature, and would be nice
>> if sling:include did also.
>>
>> Thanks,
>>
>> --mike
>