Class BaseHandlerConfig.BuilderBase<BUILDER extends BaseHandlerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends BaseHandlerConfig>
- Type Parameters:
BUILDER- type of the builder extending this abstract builderPROTOTYPE- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
- Direct Known Subclasses:
BaseHandlerConfig.Builder,ClasspathHandlerConfig.BuilderBase,FileSystemHandlerConfig.BuilderBase
- Enclosing interface:
BaseHandlerConfig
BaseHandlerConfig.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classGenerated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCachedFile(String cachedFile) A set of files that are cached in memory at startup.addCachedFiles(Set<String> cachedFiles) A set of files that are cached in memory at startup.addContentTypes(Map<String, ? extends MediaType> contentTypes) Maps a filename extension to the response content type.Sockets names (listeners) that will host this static content handler, defaults to all configured sockets.addSockets(Set<String> sockets) Sockets names (listeners) that will host this static content handler, defaults to all configured sockets.A set of files that are cached in memory at startup.cachedFiles(Set<String> cachedFiles) A set of files that are cached in memory at startup.Clear all cachedFiles.Clear existing value of memoryCache.Clear existing value of recordCacheCapacity.Clear all sockets.Clear existing value of welcome.config()Configuration used to configure this instance.Deprecated.Update builder from configuration (node of this type).Maps a filename extension to the response content type.contentTypes(Map<String, ? extends MediaType> contentTypes) Maps a filename extension to the response content type.context()Context that will serve this handler's static resources, defaults to/.Context that will serve this handler's static resources, defaults to/.booleanenabled()Whether this handle is enabled, defaults totrue.enabled(boolean enabled) Whether this handle is enabled, defaults totrue.from(BaseHandlerConfig prototype) Update this builder from an existing prototype instance.from(BaseHandlerConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.Handles will use memory cache configured onStaticContentConfig.memoryCache()by default.memoryCache(MemoryCache memoryCache) Handles will use memory cache configured onStaticContentConfig.memoryCache()by default.memoryCache(MemoryCacheConfig memoryCache) Handles will use memory cache configured onStaticContentConfig.memoryCache()by default.memoryCache(Consumer<MemoryCacheConfig.Builder> consumer) Handles will use memory cache configured onStaticContentConfig.memoryCache()by default.Map request path to resource path.pathMapper(Function<String, String> pathMapper) Map request path to resource path.protected voidHandles providers and decorators.putContentType(String key, MediaType contentType) Maps a filename extension to the response content type.Configure capacity of cache used for resources.recordCacheCapacity(int recordCacheCapacity) Configure capacity of cache used for resources.sockets()Sockets names (listeners) that will host this static content handler, defaults to all configured sockets.Sockets names (listeners) that will host this static content handler, defaults to all configured sockets.toString()protected voidValidates required properties.welcome()Welcome-file name.Welcome-file name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
config
Deprecated.Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.ConfiguredBuilder<BUILDER extends BaseHandlerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends BaseHandlerConfig> - Parameters:
config- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.ConfiguredBuilder<BUILDER extends BaseHandlerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends BaseHandlerConfig> - Parameters:
config- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
enabled
Whether this handle is enabled, defaults totrue.- Parameters:
enabled- whether enabled- Returns:
- updated builder instance
- See Also:
-
context
Context that will serve this handler's static resources, defaults to/.- Parameters:
context- context under webserver- Returns:
- updated builder instance
- See Also:
-
clearSockets
Clear all sockets.- Returns:
- updated builder instance
- See Also:
-
sockets
Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is@default.- Parameters:
sockets- sockets to register this handler on- Returns:
- updated builder instance
- See Also:
-
addSockets
Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is@default.- Parameters:
sockets- sockets to register this handler on- Returns:
- updated builder instance
- See Also:
-
addSocket
Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is@default.- Parameters:
socket- add single sockets to register this handler on- Returns:
- updated builder instance
- See Also:
-
clearWelcome
Clear existing value of welcome.- Returns:
- updated builder instance
- See Also:
-
welcome
Welcome-file name. In case a directory is requested, this file would be served if present. There is no welcome file by default.- Parameters:
welcome- welcome-file name, such asindex.html- Returns:
- updated builder instance
- See Also:
-
clearCachedFiles
Clear all cachedFiles.- Returns:
- updated builder instance
- See Also:
-
cachedFiles
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!
- Parameters:
cachedFiles- set of file names (or directory names if not using classpath) to cache in memory on startup- Returns:
- updated builder instance
- See Also:
-
addCachedFiles
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!
- Parameters:
cachedFiles- set of file names (or directory names if not using classpath) to cache in memory on startup- Returns:
- updated builder instance
- See Also:
-
addCachedFile
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!
- Parameters:
cachedFile- add single set of file names (or directory names if not using classpath) to cache in memory on startup- Returns:
- updated builder instance
- See Also:
-
clearMemoryCache
Clear existing value of memoryCache.- Returns:
- updated builder instance
- See Also:
-
memoryCache
Handles will use memory cache configured onStaticContentConfig.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.- Parameters:
memoryCache- memory cache to use with this handler- Returns:
- updated builder instance
- See Also:
-
memoryCache
Handles will use memory cache configured onStaticContentConfig.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.- Parameters:
memoryCache- prototype of memory cache to use with this handler- Returns:
- updated builder instance
- See Also:
-
memoryCache
Handles will use memory cache configured onStaticContentConfig.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.- Parameters:
consumer- consumer of builder of memory cache to use with this handler- Returns:
- updated builder instance
- See Also:
-
contentTypes
Maps a filename extension to the response content type. To have a system-wide configuration, you can use the service loader SPIMediaTypeDetector.This method can override
MediaTypesdetection for a specific static content handler.Handler will use a union of configuration on the
StaticContentConfigand here when used from configuration. This method replaces all values with the new ones.- Parameters:
contentTypes- map of file extensions to associated media type- Returns:
- updated builder instance
- See Also:
-
addContentTypes
Maps a filename extension to the response content type. To have a system-wide configuration, you can use the service loader SPIMediaTypeDetector.This method can override
MediaTypesdetection for a specific static content handler.Handler will use a union of configuration on the
StaticContentConfigand here when used from configuration. This method keeps existing values, then puts all new values into the map.- Parameters:
contentTypes- map of file extensions to associated media type- Returns:
- updated builder instance
- See Also:
-
putContentType
Maps a filename extension to the response content type. To have a system-wide configuration, you can use the service loader SPIMediaTypeDetector.This method can override
MediaTypesdetection for a specific static content handler.Handler will use a union of configuration on the
StaticContentConfigand here when used from configuration. This method adds a new value to the map, or replaces it if the key already exists.- Parameters:
key- key to add or replacecontentType- new value for the key- Returns:
- updated builder instance
- See Also:
-
pathMapper
Map request path to resource path. Default uses the same path as requested. This can be used to resolve all paths to a single file, or to filter out files.- Parameters:
pathMapper- function to map request path to resource path- Returns:
- updated builder instance
- See Also:
-
clearRecordCacheCapacity
Clear existing value of recordCacheCapacity.- Returns:
- updated builder instance
- See Also:
-
recordCacheCapacity
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
BaseHandlerConfig.memoryCache()- Parameters:
recordCacheCapacity- maximal number of cached records, only caches media type and Path, not the content- Returns:
- updated builder instance
- See Also:
-
enabled
public boolean enabled()Whether this handle is enabled, defaults totrue.- Returns:
- whether enabled
-
context
Context that will serve this handler's static resources, defaults to/.- Returns:
- context under webserver
-
sockets
Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is@default.- Returns:
- sockets to register this handler on
-
welcome
Welcome-file name. In case a directory is requested, this file would be served if present. There is no welcome file by default.- Returns:
- welcome-file name, such as
index.html
-
cachedFiles
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!
- Returns:
- set of file names (or directory names if not using classpath) to cache in memory on startup
-
memoryCache
Handles will use memory cache configured onStaticContentConfig.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.- Returns:
- memory cache to use with this handler
-
contentTypes
Maps a filename extension to the response content type. To have a system-wide configuration, you can use the service loader SPIMediaTypeDetector.This method can override
MediaTypesdetection for a specific static content handler.Handler will use a union of configuration on the
StaticContentConfigand here when used from configuration.- Returns:
- map of file extensions to associated media type
-
pathMapper
Map request path to resource path. Default uses the same path as requested. This can be used to resolve all paths to a single file, or to filter out files.- Returns:
- function to map request path to resource path
-
recordCacheCapacity
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
BaseHandlerConfig.memoryCache()- Returns:
- maximal number of cached records, only caches media type and Path, not the content
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties. -
config
Configuration used to configure this instance.- Returns:
- config instance
-
config(io.helidon.config.Config)