Interface StaticContentConfig
- All Superinterfaces:
Prototype.Api, Prototype.Factory<StaticContentFeature>
- All Known Implementing Classes:
StaticContentConfig.BuilderBase.StaticContentConfigImpl
Configuration of Static content feature.
Minimal example configuring a single classpath resource (properties):
server.features.static-content.classpath.0.context=/static server.features.static-content.classpath.0.location=/weband using yaml:
server:
features:
static-content:
classpath:
- context: "/static"
location: "/web"
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forStaticContentFeature.static classStaticContentConfig.BuilderBase<BUILDER extends StaticContentConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends StaticContentConfig>Fluent API builder base forStaticContentConfig. -
Method Summary
Modifier and TypeMethodDescriptionstatic StaticContentConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static StaticContentConfig.Builderbuilder(StaticContentConfig instance) Create a new fluent API builder from an existing instance.List of classpath based static content handlers.Maps a filename extension to the response content type.static StaticContentConfigcreate()Create a new instance with default values.static StaticContentConfigCreate a new instance from configuration.booleanenabled()Whether this feature is enabled, defaults totrue.Memory cache shared by the whole feature.name()Name of this instance.path()List of file system based static content handlers.booleanWhether classpath sidecar resources may be sourced from a different classpath origin than the logical resource by default for feature-registered handlers.booleanWhether pre-compressed sidecar resources should be selected by default for feature-registered directory and classpath handlers; this is disabled by default and does not apply to file system handlers configured with a single file, which require handler-level opt-in.Pre-compressed content coding to file suffix mappings; defaults include br to br and gzip to gz, handler-level mappings replace these mappings rather than merging with them, an explicit empty map disables sidecar lookups by default, codings must be unique concrete valid HTTP tokens other thanidentityand*, and suffixes have leading dots ignored and must not contain path separators.sockets()Sockets names (listeners) that will host static content handlers, defaults to all configured sockets.Temporary storage to use across all classpath handlers.doubleweight()Weight of the static content feature.welcome()Welcome-file name.Methods inherited from interface Prototype.Factory
buildModifier and TypeMethodDescriptionbuild()Create a new instance of the runtime type from this config object.
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
enabled
boolean enabled()Whether this feature is enabled, defaults totrue.- Returns:
- whether this feature is enabled
-
weight
double weight()Weight of the static content feature. Defaults to 95.0.- Returns:
- weight of the feature
-
name
-
memoryCache
Optional<MemoryCache> memoryCache()Memory cache shared by the whole feature. If not configured, files are not cached in memory (except for explicitly marked files/resources in each section).- Returns:
- memory cache, if configured
-
temporaryStorage
Optional<TemporaryStorage> temporaryStorage()Temporary storage to use across all classpath handlers. If not defined, a default one will be created.- Returns:
- temporary storage
-
classpath
List<ClasspathHandlerConfig> classpath()List of classpath based static content handlers.- Returns:
- classpath handlers
-
path
List<FileSystemHandlerConfig> path()List of file system based static content handlers.- Returns:
- path handlers
-
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 defined here, and on the handler here when used from configuration.
- Returns:
- map of file extensions to associated media type
-
welcome
-
sockets
-
preCompressedEnabled
boolean preCompressedEnabled()Whether pre-compressed sidecar resources should be selected by default for feature-registered directory and classpath handlers; this is disabled by default and does not apply to file system handlers configured with a single file, which require handler-level opt-in.- Returns:
- whether pre-compressed sidecar resources should be used
-
preCompressedCrossOriginSourcingEnabled
boolean preCompressedCrossOriginSourcingEnabled()Whether classpath sidecar resources may be sourced from a different classpath origin than the logical resource by default for feature-registered handlers.- Returns:
- whether cross-origin classpath sidecar sourcing is enabled by default
-
preCompressedEncodings
Pre-compressed content coding to file suffix mappings; defaults include br to br and gzip to gz, handler-level mappings replace these mappings rather than merging with them, an explicit empty map disables sidecar lookups by default, 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
-