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

Dette produktet er lisensiert i henhold til Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Innlegg på Twitter™ og Facebook dekkes ikke av Creative Commons-vilkår.

Juridiske merknader   |   Regler for personvern på nettet