Private Assets

The application engine is responsible for making private assets, assets that are stored on the Java classpath, visible when necessary to client web browser.

This takes two forms:

The first form is the default behavior; each private asset requires an additional round trip through the application server and application engine to retrieve the stream of bytes which make up the asset. This is fine during development, but less than ideal at deployment, since it places an extra burden on the servlet container, stealing valuable cycles away from the main aspects of servicing end users.

The second form is better during deployment. The bytestreams are copied out of the classpath to a specific directory, one that is mapped into the web server's virtual file system. Once it is so copied, the access to the asset is completely static, as with any other image file or HTML page.

To enable dynamic copying, it is necessary to inform the framework about what file system directory to copy the assets to, and what virtual file system directory that maps to. This is accomplished using a pair of JVM system properties:

JVM System Properties

org.apache.tapestry.asset.dir

The complete pathname of a directory to which private assets may be copied by the asset externalizer.

org.apache.tapestry.asset.URL

The URL corresponding to the external asset directory.