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 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.addPreCompressedEncodings(Map<String, String> preCompressedEncodings) Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.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 preCompressedEnabled.Clear existing value of preCompressedEncodings.Clear existing value of recordCacheCapacity.Clear all sockets.Clear existing value of welcome.config()Configuration used to configure this instance.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.Whether pre-compressed sidecar resources should be selected for this handler; feature-registered handlers inherit the feature value when absent, directly created handlers default to disabled, and file system handlers configured with a single file always require handler-level opt-in.preCompressedEnabled(boolean preCompressedEnabled) Whether pre-compressed sidecar resources should be selected for this handler; feature-registered handlers inherit the feature value when absent, directly created handlers default to disabled, and file system handlers configured with a single file always require handler-level opt-in.Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.preCompressedEncodings(Map<String, String> preCompressedEncodings) Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.putContentType(String key, MediaType contentType) Maps a filename extension to the response content type.putPreCompressedEncoding(String key, String preCompressedEncoding) Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.Configures the capacity of the cache used for resource metadata.recordCacheCapacity(int recordCacheCapacity) Configures the capacity of the cache used for resource metadata.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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface 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:
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
-
clearSockets
-
sockets
-
addSockets
-
addSocket
-
clearWelcome
Clear existing value of welcome.- Returns:
- updated builder instance
- See Also:
-
welcome
-
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 are snapshots. They remain available and are never re-loaded, even if their source is changed or removed, 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 are snapshots. They remain available and are never re-loaded, even if their source is changed or removed, 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 are snapshots. They remain available and are never re-loaded, even if their source is changed or removed, 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
Configures the capacity of the cache used for resource metadata. Pre-compressed sidecar lookup state is attached to the corresponding normal resource record.To cache content (bytes) in memory, use
BaseHandlerConfig.memoryCache()- Parameters:
recordCacheCapacity- maximal number of cached records; records do not contain the content bytes- Returns:
- updated builder instance
- See Also:
-
clearPreCompressedEnabled
Clear existing value of preCompressedEnabled.- Returns:
- updated builder instance
- See Also:
-
preCompressedEnabled
Whether pre-compressed sidecar resources should be selected for this handler; feature-registered handlers inherit the feature value when absent, directly created handlers default to disabled, and file system handlers configured with a single file always require handler-level opt-in.- Parameters:
preCompressedEnabled- whether pre-compressed sidecar resources should be used- Returns:
- updated builder instance
- See Also:
-
clearPreCompressedEncodings
Clear existing value of preCompressedEncodings.- Returns:
- updated builder instance
- See Also:
-
preCompressedEncodings
Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.- Parameters:
preCompressedEncodings- content coding to file suffix mappings- Returns:
- updated builder instance
- See Also:
-
addPreCompressedEncodings
Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.- Parameters:
preCompressedEncodings- add values to content coding to file suffix mappings- Returns:
- updated builder instance
- See Also:
-
putPreCompressedEncoding
Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators. This method adds a new value to the map, or replaces it if the key already exists.- Parameters:
key- key to add or replacepreCompressedEncoding- new value for the key- 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
-
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 are snapshots. They remain available and are never re-loaded, even if their source is changed or removed, 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
-
recordCacheCapacity
Configures the capacity of the cache used for resource metadata. Pre-compressed sidecar lookup state is attached to the corresponding normal resource record.To cache content (bytes) in memory, use
BaseHandlerConfig.memoryCache()- Returns:
- maximal number of cached records; records do not contain the content bytes
-
preCompressedEnabled
Whether pre-compressed sidecar resources should be selected for this handler; feature-registered handlers inherit the feature value when absent, directly created handlers default to disabled, and file system handlers configured with a single file always require handler-level opt-in.- Returns:
- whether pre-compressed sidecar resources should be used
-
preCompressedEncodings
Pre-compressed content coding to file suffix mappings; handler mappings replace inherited feature-level mappings rather than merging with them, an explicit empty map disables sidecar lookups for this handler, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.- Returns:
- content coding to file suffix mappings
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties. -
config
-