Clarify difference between data-sly-include and data-sly-resource
tripodsan opened this issue · 3 comments
the spec does not clearly state the difference between data-sly-include and data-sly-resource.
it would be nice to give an example.
when looking at the implementations of the extensions:
- https://github.com/apache/sling-org-apache-sling-scripting-sightly/blob/master/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
- https://github.com/apache/sling-org-apache-sling-scripting-sightly/blob/master/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java
it looks like data-sly-resource creates a new internal request against the sling engine, where as data-sly-include looks for the specified script/servlet and executes it, using the same request context, i.e. the same current resource.
so data-sly-resource can be compared with a <jsp:include page="" />
and data-sly-include is similar to <%@ include file="" %>
@raducotescu correct?
@tripodsan, that's the correct analogy and the specification does mention this:
data-sly-include
:
- Includes the output of a rendering script run with the current context.
data-sly-resource
:
- Includes a rendered resource.
would be nice to update the specification. imo, only people familiar with sling might possibly understand the current description. I will provide a PR.