Expand my Community achievements bar.

SOLVED

sling dynamic inlcude

Avatar

Level 1

Hi Guys , I jsut have two questions regarding sling dynamic include 

I will provide the steps i followed , 

please correct if anything is 

1. Include the SDI as a dependency in the ui.apps pom.xml

<!-- Sling dynamic include -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.dynamic-include</artifactId>
</dependency>

2. Embed the SDI as a package for deployment in ui.apps pom.xml

<embedded>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.dynamic-include</artifactId>
<target>/apps/my-site/install</target>
</embedded>

3. Include the SDI as a dependency in the parent pom.xml

<!-- Sling dynamic include -->
<dependency>
  <groupId>org.apache.sling</groupId>
  <artifactId>org.apache.sling.dynamic-include</artifactId>
  <version>3.1.2</version>
</dependency>

4. create o OSGI config ;
ui.config/src/main/content/jcr_root/apps/mysite/osgiconfig/config.publish.dev

// Configuration created by Apache Sling JCR Installer
{
"include-filter.config.enabled":true,
"include-filter.config.selector":"nocache",
"include-filter.config.include-type":"SSI",
"include-filter.config.resource-types":[
"mysite/components/content/form/container"
],
"include-filter.config.path":"/content/mysite"
}

5. I rolled out the required dispacther changes and apachae configurations 

1) Allow dispatcher module 

LoadModule include_module modules/mod_include.so

2) Modify the <Directory> Block

configure the directory to enable SSI processing

 

<Directory "${DOCROOT}">
   RequestHeader unset Authorization
   Options Indexes FollowSymLinks Includes
  AllowOverride None
  Require all granted
  AddOutputFilter INCLUDES .html
</Directory>

 

 

3)Define a cache rule in dispatcher for not to cache content URL’s ending with .nocache.html

/0001 { /glob “.nocache.html” /type “deny” }{}{*}
My questions 
1) Is the configuration name correct? Should it be "org.apache.sling.dynamicinclude.impl.DynamicIncludeFilter" or "org.apache.sling.dynamicinclude.Configuration.cfg.json"?

2)Is it neccesary to embed the sling dynaminc include bundle  or depency is enough ?
<embedded>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.dynamic-include</artifactId>
<target>/apps/my-site/install</target>
</embedded>

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @udhayaprakash 

You need to change the config, its a factory config

e.g. org.apache.sling.dynamicinclude.Configuration-demo.cfg.json 

Yes, you need to embed sdi in order to deploy on AEM

 

Example - 

https://github.com/arunpatidar02/aemaacs-aemlab/pull/21/files 

Arun Patidar

AEM LinksLinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @udhayaprakash 

You need to change the config, its a factory config

e.g. org.apache.sling.dynamicinclude.Configuration-demo.cfg.json 

Yes, you need to embed sdi in order to deploy on AEM

 

Example - 

https://github.com/arunpatidar02/aemaacs-aemlab/pull/21/files 

Arun Patidar

AEM LinksLinkedIn

Avatar

Level 1

HI @arunpatidar 

Thanks for the pull request 

That's a enough information for me .