Hosted by Three Crickets

Web Framework
For Prudence and MongoDB

Diligence is still under development and incomplete, and some this documentation is wrong. For a more comprehensive but experimental version download the Savory Framework, which was the preview release of Diligence.

Diligence logo: sleeping monkey

Assets Service

An "asset" is a common term for statically served files, such as images. Because assets use a lot of bandwidth to download, they are often cached on web browser clients (configured via a "cacheControl" route type in routing.js).
This service generates asset URLs, commonly used in dynamically generated HTML. The URLs are based on a user-defined template, although the default should suffice for most use cases.
The important feature added by this service is the ability to use the asset's base64-encoded cached content digest (usually a SHA-1) in the asset's generated URL. By specifically using this digest as a query param to the URL, two things are accomplished: 1) the URL will still be routed to the resources normally, because query params are not use by the "static" route type, and 2) because the URL is different, web browsers will use a different cache for the asset per client content.
The end result is that you could cache assets in clients for as long as you want (using "farFuture" for "cacheControl") while maintaining the ability to effectively bypass the cache for an asset whenever its content changes.
The asset digests are stored in a "digests.conf" file in the application's root subdirectory. It is a JVM properties file matching asset names to their digests. You can generate this file automatically using the "diligence:digests" Sincerity command.


Make sure to check out the API documentation for Diligence.Assets.

The Diligence Manual is provided for you under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The complete manual is available for download as a PDF.

Download manual as PDF Creative Commons License