[ 
https://issues.apache.org/jira/browse/SLING-41?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger closed SLING-41.
----------------------------------

    Resolution: Fixed

First I added another implementation of the Content interface: 
org.apache.sling.content.jcr.SyntheticContent. This implementation is a blank 
extension of the abstract BaseContent class, which provides a constructor 
taking a path and component ID. This class makes it easy to provide content to 
the system to call specific handling.

The sling:include tag is extended with a new componentId attribute, which only 
is used if the path attribute is set and the content attribute is not set:

If the componentId attribute is set, the tag handler tries to request a Content 
object for the set path. If such a Content object exists, that object is used. 
If no such content object exists, a SyntheticContent instance is created with 
the set path and component Id. This synthetic Content object is then used.

If the componentId attribute is not set, the path is forwarded to the request 
dispatcher for further treatment.

Please be aware of the slight semantic difference regarding the path depending 
on whether the compoinentId attribute is set or not: If the componentId is not 
set, the path may include selectors and extensions besides the path to the 
Content itself as the request dispatcher is able to find the Content object and 
then use the selectors and extensions as input to the included Component. If 
the componentId is set, the request dispatcher is not used to find the Content 
object, instead the path must exactly address the content.

> Create synthetic content in sling:include if real content does not exist
> ------------------------------------------------------------------------
>
>                 Key: SLING-41
>                 URL: https://issues.apache.org/jira/browse/SLING-41
>             Project: Sling
>          Issue Type: Improvement
>          Components: JSP
>    Affects Versions: 2.0.0
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> Consider a page component which includes a footer. Such a footer may or may 
> not exist. If no real content exists, it would be usefull, if a simple 
> Content instance with just the path and the component ID would be created to 
> render a default footer. To support this feature, a new attribute - the 
> component id - needs to be added to the sling:include tag.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to