Instellen Sling Dynamic Include

Een videolooppas-door van het installeren van en het gebruiken van Apache Sling Dynamic Include met ​ AEM Dispatcher ​ lopend op Apache HTTP Web Server.

NOTE
Controleer of de nieuwste versie van AEM Dispatcher lokaal is geïnstalleerd.
  1. Download en installeer de Sling Dynamic Include bundel ​.

  2. Vorm Sling Dynamic Include via OSGi Configuration Factory in http://<host>:<port>/system/console/configMgr/org.apache.sling.dynamicinclude.Configuration.

    Of, om aan een code-basis van AEM toe te voegen, creeer de aangewezen gooi:OsgiConfig knoop bij:

    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+)
    -->
    
  3. (Facultatief) herhaal de laatste stap om voor componenten op ​ gesloten (aanvankelijke) inhoud van editable malplaatjes ​ toe te staan om via SDI eveneens te worden gediend. De reden voor de extra configuratie is dat vergrendelde inhoud van bewerkbare sjablonen wordt aangeboden vanuit /conf in plaats van /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+)
    -->
    
  4. Werk het httpd.conf -bestand van Apache HTTPD Web server bij om de Include -module in te schakelen.

    code language-shell
    $ sudo vi .../httpd.conf
    
    code language-shell
    LoadModule include_module libexec/apache2/mod_include.so
    
  5. Werk het vhost -bestand bij om instructies te respecteren.

    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>
    
  6. Werk het dispatcher.any-configuratiebestand bij ter ondersteuning van (1) nocache kiezers en (2) schakel TTL-ondersteuning in.

    code language-shell
    $ sudo vi .../conf/dispatcher.any
    
    code language-shell
    /rules {
      ...
      /0009 {
        /glob "*.nocache.html*"
        /type "deny"
      }
    }
    
    note tip
    TIP
    Als u de * volgende regel in de algemene regel *.nocache.html* hierboven weglaat, kan dit resulteren in ​ problemen in verzoeken om subresources ​ .
    code language-shell
    /cache {
        ...
        /enableTTL "1"
    }
    
  7. Start Apache HTTP Web Server altijd opnieuw nadat u wijzigingen hebt aangebracht in de configuratiebestanden of in dispatcher.any .

    code language-shell
    $ sudo apachectl restart
    
NOTE
Als u Sling Dynamic Includes voor het dienen van rand-zij omvat (ESI) gebruikt, dan zorg ervoor om relevante ​ reactiekopballen in het berichtchermgeheime voorgeheugen ​ in het voorgeheugen onder te brengen. Mogelijke kopteksten zijn onder andere:
  • "Cache-control"
  • "Content-Disposition"
  • "Content-Type"
  • "Verloopt"
  • "Laatst gewijzigd"
  • "ETag"
  • "X-Content-Type-Options"
  • "Laatst gewijzigd"

Ondersteunende materialen

recommendation-more-help
c92bdb17-1e49-4e76-bcdd-89e4f85f45e6