Setup Sling Dynamic Include
Eine Videoanleitung zur Installation und Verwendung von Apache Sling Dynamic Include mit AEM Dispatcher auf einem Apache HTTP Web Server.
-
Laden Sie das Sling Dynamic Include Bundle herunter und installieren Sie es.
-
Konfigurieren Sie Sling Dynamic Include über die OSGi Configuration Factory unter http://<host>:<port>/system/console/configMgr/org.apache.sling.dynamicinclude.Configuration.
Oder erstellen Sie, um eine AEM-Code-Basis hinzuzufügen, den entsprechenden sling:OsgiConfig-Knoten unter:
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+) -->
-
(Optional) Wiederholen Sie den letzten Schritt, um zuzulassen, dass Komponenten zu gesperrten (anfänglichen) Inhalten bearbeitbarer Vorlagen ebenfalls über SDI bereitgestellt werden. Der Grund für die zusätzliche Konfiguration besteht darin, dass gesperrte Inhalte bearbeitbarer Vorlagen über
/conf
und nicht über/content
bereitgestellt werden.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+) -->
-
Aktualisieren Sie die Datei
httpd.conf
des Apache HTTPD Web servers, um das Modul Include zu aktivieren.code language-shell $ sudo vi .../httpd.conf
code language-shell LoadModule include_module libexec/apache2/mod_include.so
-
Aktualisieren Sie die vhost-Datei, damit die Include-Anweisungen befolgt werden.
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>
-
Aktualisieren Sie die Konfigurationsdatei „dispatcher.any“, um erstens
nocache
-Selektoren zu unterstützen und zweitens die TTL-Unterstützung zu aktivieren.code language-shell $ sudo vi .../conf/dispatcher.any
code language-shell /rules { ... /0009 { /glob "*.nocache.html*" /type "deny" } }
note tip TIP Wird das nachstehende *
in der glob-Regel*.nocache.html*
belassen, kann dies zu Problemen bei Anfragen für Unterressourcen führen.code language-shell /cache { ... /enableTTL "1" }
-
Starten Sie den Apache HTTP Web Server immer neu, nachdem Sie Änderungen an den Konfigurationsdateien oder an
dispatcher.any
vorgenommen haben.code language-shell $ sudo apachectl restart
- "Cache-Control"
- "Content-Disposition"
- "Content-Type"
- "Ablaufdatum"
- "Last-Modified"
- "ETag"
- "X-Content-Type-Options"
- "Last-Modified"