Konfigurera Sling Dynamic Include
En genomgång av hur du installerar och använder Apache Sling Dynamic Include med AEM Dispatcher som körs på Apache HTTP Web Server.
-
Hämta och installera Sling Dynamic Include paketet.
-
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 en AEM kodbas, skapar du lämplig sling:OsgiConfig -nod på:
code language-xml <?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 även tillåta att komponenter i låst (ursprungligt) innehåll i redigerbara mallar kan hanteras via SDI. Orsaken till den extra konfigurationen är att låst innehåll i redigerbara mallar hanteras från
/conf
i stället för/content
.code language-xml <?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 filen
httpd.conf
för Apache HTTPD Web server för att aktivera modulen Include.code language-shell $ sudo vi .../httpd.conf
code language-shell LoadModule include_module libexec/apache2/mod_include.so
-
Uppdatera filen vhost så att den respekterar direktiv om inkludering.
code language-shell $ sudo vi .../vhosts/aem-publish.local.conf
code language-shell <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.any-konfigurationsfilen så att den stöder (1)
nocache
väljare och (2) aktivera stöd för TTL.code language-shell $ sudo vi .../conf/dispatcher.any
code language-shell /rules { ... /0009 { /glob "*.nocache.html*" /type "deny" } }
note tip TIP Om du lämnar det avslutande *
i glob*.nocache.html*
-regeln ovan kan det leda till problem i förfrågningar för underresurser.code language-shell /cache { ... /enableTTL "1" }
-
Starta alltid om Apache HTTP Web Server när du har gjort ändringar i konfigurationsfilerna eller i
dispatcher.any
.code language-shell $ sudo apachectl restart
- "Cache-Control"
- "Content-Disposition"
- "Content-Type"
- "Förfaller"
- "Senast ändrad"
- "ETag"
- "X-content-type-options"
- "Senast ändrad"