Configuration options

Table 1. Optional configuration options
key type default value description

cached-files

string[]

 

A set of files that are cached in memory at startup. These files are never removed from the in-memory cache, though their overall size is added to the memory cache used bytes. When using classpath, the set must contain explicit list of all files that should be cached, when using file system, it can contain a directory, and all files under that directory (recursive) would be cached as well.

Note that files cached through this method may use more than the max-bytes configured for the in-memory cache (i.e. this option wins over the maximal size in bytes), so kindly be careful with what is pushed to the cache.

Files cached in memory will never be re-loaded, even if changed, until server restart!

content-types

Map<string, MediaType>

 

Maps a filename extension to the response content type. To have a system-wide configuration, you can use the service loader SPI io.helidon.common.media.type.spi.MediaTypeDetector.

This method can override io.helidon.common.media.type.MediaTypes detection for a specific static content handler.

Handler will use a union of configuration on the io.helidon.webserver.staticcontent.StaticContentConfig and here when used from configuration.

context

string

/

Context that will serve this handler’s static resources, defaults to /.

enabled

boolean

true

Whether this handle is enabled, defaults to true.

location

Path

 

The directory (or a single file) that contains the root of the static content.

memory-cache

 

Handles will use memory cache configured on StaticContentConfig.memoryCache() by default. In case a memory cache is configured here, it will replace the memory cache used by the static content feature, and this handle will use a dedicated memory cache instead.

To disable memory caching for a single handler, create the configuration, and set enabled: false.

record-cache-capacity

int

 

Configure capacity of cache used for resources. This cache will make sure the media type and location is discovered faster.

To cache content (bytes) in memory, use io.helidon.webserver.staticcontent.BaseHandlerConfig.memoryCache()

sockets

string[]

 

Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is @default.

welcome

string

 

Welcome-file name. In case a directory is requested, this file would be served if present. There is no welcome file by default.