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 class
Fluent API builder forStaticContentFeature
.static class
StaticContentConfig.BuilderBase<BUILDER extends StaticContentConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends StaticContentConfig> Fluent API builder base forStaticContentFeature
. -
Method Summary
Modifier and TypeMethodDescriptionstatic StaticContentConfig.Builder
builder()
Create a new fluent API builder to customize configuration.static StaticContentConfig.Builder
builder
(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 StaticContentConfig
create()
Create a new instance with default values.static StaticContentConfig
Create a new instance from configuration.boolean
enabled()
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.sockets()
Sockets names (listeners) that will host static content handlers, defaults to all configured sockets.Temporary storage to use across all classpath handlers.double
weight()
Weight of the static content feature.welcome()
Welcome-file name.Methods inherited from interface io.helidon.builder.api.Prototype.Factory
build
-
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
String name()Name of this instance.- Returns:
- instance 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
MediaTypes
detection 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
Welcome-file name. Default for all handlers. By default, we do not serve default files.- Returns:
- welcome-file name, such as
index.html
-
sockets
Sockets names (listeners) that will host static content handlers, defaults to all configured sockets. Default socket name is@default
.This configures defaults for all handlers.
- Returns:
- sockets to register this handler on
-