Sei sulla pagina 1di 5

Adobe Experience Manager Getting Started Tutorials  

AEM Foundation Videos and Tutorials

Set up Sling Dynamic Include


A video walk-through of installing and using Apache Sling Dynamic Include with AEM Dispatcher
running on Apache HTTP Web Server.

NO TE

Ensure the latest version of AEM Dispatcher is installed locally.

1. Download and install the [Sling Dynamic Include] bundle .

2. Configure Sling Dynamic Include via the OSGi Configuration Factory at http://<host>:
<port>/system/console/configMgr/org.apache.sling.dynamicinclude.Configuration .
Or, to add to an AEM code-base, create the appropriate sling:OsgiConfig node at:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="ht
xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jc
jcr:primaryType="sling:OsgiConfig"
include-filter.config.enabled="{Boolean}true"
include-filter.config.path="/content"
include-filter.config.resource-types="[my-app/components/content/highl
include-filter.config.include-type="SSI"
include-filter.config.add_comment="{Boolean}false"
include-filter.config.selector="nocache"
include-filter.config.ttl=""
include-filter.config.required_header="Server-Agent=Communique-Dispatc
include-filter.config.ignoreUrlParams="[]"
include-filter.config.rewrite="{Boolean}true"
/>
<!--
* include-filter.config.include-type="SSI | ESI | JSI"
* include-filter.config.ttl is # of seconds (requires AEM Dispatcher 4.1.1
-->

3. (Optional) Repeat the last step to allow for components on locked (initial) content of
editable templates to be served via SDI as well. The reason for the additional configuration
is that locked content of editable templates is served from /conf instead of /content .

<?xml version="1.0" encoding="UTF-8"?>


<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="ht
xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jc
jcr:primaryType="sling:OsgiConfig"
include-filter.config.enabled="{Boolean}true"
include-filter.config.path="/conf"
include-filter.config.resource-types="[my-app/components/content/highl
include-filter.config.include-type="SSI"
include-filter.config.add_comment="{Boolean}false"
include-filter.config.selector="nocache"
include-filter.config.ttl=""
include-filter.config.required_header="Server-Agent=Communique-Dispatc
include-filter.config.ignoreUrlParams="[]"
include-filter.config.rewrite="{Boolean}true"
/>
<!--
* include-filter.config.include-type="SSI | ESI | JSI"
* include-filter.config.ttl is # of seconds (requires AEM Dispatcher 4.1.1
-->
4. Update Apache HTTPD Web server's httpd.conf file to enable the Include module.

$ sudo vi .../httpd.conf

LoadModule include_module libexec/apache2/mod_include.so

5. Update the vhost file to respect include directives.

$ sudo vi .../vhosts/aem-publish.local.conf

<VirtualHost *:80>
...
<Directory /Library/WebServer/docroot/publish>
...
# Add Includes to enable SSI Includes used by Sling Dynamic Include
Options FollowSymLinks Includes

# Required to have dispatcher-handler process includes


ModMimeUsePathInfo On

# Set includes to process .html files


AddOutputFilter INCLUDES .html
...
</Directory>
...
</VirtualHost>

6. Update the dispatcher.any configuration file to support (1) nocache selectors and (2)
enable TTL support.

$ sudo vi .../conf/dispatcher.any
/rules {
...
/0009 {
/glob "*.nocache.html*"
/type "deny"
}
}

TI P

Leaving the trailing * off in the glob *.nocache.html* rule above, can result in
issues in requests for sub-resources .

/cache {
...
/enableTTL "1"
}

7. Always restart Apache HTTP Web Server after making changes to its configuration files or
the dispatcher.any .

$ sudo apachectl restart

NO TE

If you are using Sling Dynamic Includes for serving edge-side includes (ESI), then make sure
to cache relevant response headers in the dispatcher cache . Possible headers include the
following:
"Cache-Control"

"Content-Disposition"

"Content-Type"

"Expires"

"Last-Modified"

"ETag"

"X-Content-Type-Options"

"Last-Modified"
Supporting materials
Download Sling Dynamic Include bundle

Apache Sling Dynamic Include documentation

Copyright © 2020 Adobe. All Rights Reserved. / Privacy / Terms of use / Cookies / AdChoices

Potrebbero piacerti anche