3.4 Referencing Resources

If the snap needs to lookup any resources, this can be done in the normal way and if the resource cannot be found in the snap, then the host will be checked. Remember that a host and all its snaps use a single ServletContext. As the snap is always checked first it can hide resources at the same path in its host. So if you want to look up a resource in the snaps host that exists in the snap simply prefix the path with host:. This will then cause the Snaps system to bypass the snap and look only in its host for the requested resource. If it is not found in its host the snap will NOT be checked, the lookup will return with nothing.


This line of Java code gets the ServletContext from the HttpRequest object and then tries to get a resource from the host, bypassing the snap.