En videogenomgång av hur du installerar och använder Apache Sling Dynamic Include med AEM Dispatcher körs Apache HTTP Web Server.
Kontrollera att den senaste versionen av AEM Dispatcher är installerad lokalt.
Hämta och installera Sling Dynamic Include paket.
Konfigurera Sling Dynamic Include via OSGi Configuration Factory på http://<host>:<port>/system/console/configMgr/org.apache.sling.dynamicinclude.Configuration.
Eller, om du vill lägga till i en AEM kodbas, skapa sling:OsgiConfig nod vid:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="sling:OsgiConfig"
include-filter.config.enabled="{Boolean}true"
include-filter.config.path="/content"
include-filter.config.resource-types="[my-app/components/content/highly-dynamic]"
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-Dispatcher"
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.11+)
-->
(Valfritt) Upprepa det sista steget för att tillåta komponenter på låst (ursprungligt) innehåll i redigerbara mallar att delges via SDI också. Orsaken till den extra konfigurationen är att låst innehåll i redigerbara mallar hanteras från /conf
i stället för /content
.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="sling:OsgiConfig"
include-filter.config.enabled="{Boolean}true"
include-filter.config.path="/conf"
include-filter.config.resource-types="[my-app/components/content/highly-dynamic]"
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-Dispatcher"
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.11+)
-->
Uppdatera Apache HTTPD Web server's httpd.conf
fil för att aktivera Include -modul.
$ sudo vi .../httpd.conf
LoadModule include_module libexec/apache2/mod_include.so
Uppdatera vhost fil som ska följas innehåller direktiv.
$ 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>
Uppdatera dispatcher.alla konfigurationsfiler som stöds (1) nocache
väljare och (2) aktivera stöd för TTL.
$ sudo vi .../conf/dispatcher.any
/rules {
...
/0009 {
/glob "*.nocache.html*"
/type "deny"
}
}
Lämna efterföljande *
av i glob *.nocache.html*
linje före, kan resultera i problem vid begäran om underresurser.
/cache {
...
/enableTTL "1"
}
Starta alltid om Apache HTTP Web Server efter att ha gjort ändringar i konfigurationsfilerna eller dispatcher.any
.
$ sudo apachectl restart
Om du använder Sling Dynamic Includes för servering av SSI (edge-side includes), se till att cachelagra relevanta svarshuvuden i dispatchercachen. Följande rubriker är möjliga: