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>
- Direct Known Subclasses:
BaseHandlerConfig.Builder
,ClasspathHandlerConfig.BuilderBase
,FileSystemHandlerConfig.BuilderBase
- Enclosing interface:
BaseHandlerConfig
BaseHandlerConfig
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Generated 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) This method keeps existing values, then puts all new values into the map.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 existing value of this property.Clear existing value of this property.Clear existing value of this property.config()
If this instance was configured, this would be the config instance used.Update builder from configuration (node of this type).Maps a filename extension to the response content type.contentTypes
(Map<String, ? extends MediaType> contentTypes) This method replaces all values with the new ones.context()
Context that will serve this handler's static resources, defaults to/
.Context that will serve this handler's static resources, defaults to/
.boolean
enabled()
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 onStaticContentConfigBlueprint.memoryCache()
by default.memoryCache
(MemoryCache memoryCache) Handles will use memory cache configured onStaticContentConfigBlueprint.memoryCache()
by default.memoryCache
(MemoryCacheConfig memoryCacheConfig) Handles will use memory cache configured onStaticContentConfigBlueprint.memoryCache()
by default.memoryCache
(Consumer<MemoryCacheConfig.Builder> consumer) Handles will use memory cache configured onStaticContentConfigBlueprint.memoryCache()
by default.Map request path to resource path.pathMapper
(Function<String, String> pathMapper) Map request path to resource path.protected void
Handles providers and decorators.putContentType
(String key, MediaType contentType) This method adds a new value to the map, or replaces it if the key already exists.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 void
Validates 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, wait
Methods 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
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
config
in 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:
-
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
- sockets to register this handler on- Returns:
- updated builder instance
- See Also:
-
clearWelcome
Clear existing value of this property.- 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:
-
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
- 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 this property.- Returns:
- updated builder instance
- See Also:
-
memoryCache
Handles will use memory cache configured onStaticContentConfigBlueprint.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 onStaticContentConfigBlueprint.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:
memoryCacheConfig
- memory cache to use with this handler- Returns:
- updated builder instance
- See Also:
-
memoryCache
Handles will use memory cache configured onStaticContentConfigBlueprint.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
- memory cache to use with this handler- Returns:
- updated builder instance
- See Also:
-
contentTypes
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
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
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 this property.- 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
BaseHandlerConfigBlueprint.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:
- the enabled
-
context
Context that will serve this handler's static resources, defaults to/
.- Returns:
- the context
-
sockets
Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is@default
.- Returns:
- the sockets
-
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:
- the welcome
-
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:
- the cached files
-
memoryCache
Handles will use memory cache configured onStaticContentConfigBlueprint.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:
- the memory cache
-
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
MediaTypes
detection for a specific static content handler.Handler will use a union of configuration on the
StaticContentConfig
and here when used from configuration.- Returns:
- the content types
-
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:
- the path mapper
-
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
BaseHandlerConfigBlueprint.memoryCache()
- Returns:
- the record cache capacity
-
config
If this instance was configured, this would be the config instance used.- Returns:
- config node used to configure this builder, or empty if not configured
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-