Symptoms

My Application has a docroot folder (i.e /apps/myapp/docroot) and contains some static files. When trying to access those files from the / (slash) url it doesn't find them.

Cause

The Resource Resolver is not configured to map the application docroot to / (slash)

Resolution

Access the Resource Resolver configuration from the /system/console and add a mapping. Eventually your application can make this automatically during bundle activation via component (see OSGi component), or it can be done via stored configuration in the application when installing a CRX Package.

For example you can store it in /apps/myapps/config/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg

with org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg containing:

resource.resolver.mapping[]=/-/,/content/-/,/system/docroot/-/,/apps/myapp/docroot/-/

Later if this is found in a CRX Package that contains your application folder, it would automatically get applied during package installation.

Applies to

CQ 5.1 WCM

Questo prodotto è concesso in licenza in base alla licenza di Attribuzione-Non commerciale-Condividi allo stesso modo 3.0 Unported di Creative Commons.  I post su Twitter™ e Facebook non sono coperti dai termini di Creative Commons.

Note legali   |   Informativa sulla privacy online