...
Tapestry ensures that the happy.jpg
asset can be accessed from the client web browser; the src attribute of the <img> tag will be a URL that directly accesses the image file ... there's no need to unpackage the happy.jpg
file. This works for any asset file stored under the librarielibrary's root package.
This component renders out an img <img>
tag for the icon.
Often, a component library will have many different components, or even pages.
...
Tapestry uses a far-future expiration date for classpath assets; this allows browsers to aggresively aggressively cache the file, but this causes a problem should a later version of the library change the file. This is discussed in detail in Yahoo's Performance Best Practices.
...
Tapestry automatically creates a mapping for assets inside your JAR. In the above example, the icon image will be exposed as /assets/
application version/happy/components/happy.jpg
(the application version number is incorporated into the URL). The "happy" portion is a virtual folder that maps to the librarielibrary's root package (as folder org/example/happylib
on the Java classpath).
...