Resources

Where files go

In src/main/resources:

FolderUsed forServed at
webserver-resourcesCSS, JS, images/nr/app/…
publicfavicon.ico, robots.txt, …/… (site root)
app-resourcesFiles your code reads, PropertiesNot served
componentsTemplatesNot served

In templates

<wo:stylesheet filename="main.css" />
<wo:script filename="app.js" />
<wo:img filename="logo.png" alt="Logo" />

Paths are relative to webserver-resources. <wo:resourceURL filename="…" /> renders just the URL. Add namespace="…" for a plugin's resources; the default is app.

Generated images:

<wo:img data="$chartBytes" mimeType="image/png" />

These are served once, from /nd/….

In Java

final byte[] bytes = application().resourceManager()
		.obtainAppResource( "app", "countries.csv" )
		.orElseThrow()
		.bytes();

Also obtainWebserverResource and obtainPublicResource.

(TODO: streaming large resources, #40.)