Class StaticContentConfig.BuilderBase<BUILDER extends StaticContentConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends StaticContentConfig>

java.lang.Object
io.helidon.webserver.staticcontent.StaticContentConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
StaticContentConfig.Builder
Enclosing interface:
StaticContentConfig

public abstract static class StaticContentConfig.BuilderBase<BUILDER extends StaticContentConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends StaticContentConfig> extends Object implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for StaticContentFeature.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(StaticContentConfig prototype)
      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

      public BUILDER from(StaticContentConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config 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 interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends StaticContentConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends StaticContentConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • enabled

      public BUILDER enabled(boolean enabled)
      Whether this feature is enabled, defaults to true.
      Parameters:
      enabled - whether this feature is enabled
      Returns:
      updated builder instance
      See Also:
    • weight

      public BUILDER weight(double weight)
      Weight of the static content feature. Defaults to 95.0.
      Parameters:
      weight - weight of the feature
      Returns:
      updated builder instance
      See Also:
    • name

      public BUILDER name(String name)
      Name of this instance.
      Parameters:
      name - instance name
      Returns:
      updated builder instance
      See Also:
    • clearMemoryCache

      public BUILDER clearMemoryCache()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • memoryCache

      public BUILDER memoryCache(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).
      Parameters:
      memoryCache - memory cache, if configured
      Returns:
      updated builder instance
      See Also:
    • memoryCache

      public BUILDER memoryCache(MemoryCacheConfig memoryCacheConfig)
      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).
      Parameters:
      memoryCacheConfig - memory cache, if configured
      Returns:
      updated builder instance
      See Also:
    • memoryCache

      public BUILDER memoryCache(Consumer<MemoryCacheConfig.Builder> consumer)
      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).
      Parameters:
      consumer - memory cache, if configured
      Returns:
      updated builder instance
      See Also:
    • clearTemporaryStorage

      public BUILDER clearTemporaryStorage()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • temporaryStorage

      public BUILDER temporaryStorage(TemporaryStorage temporaryStorage)
      Temporary storage to use across all classpath handlers. If not defined, a default one will be created.
      Parameters:
      temporaryStorage - temporary storage
      Returns:
      updated builder instance
      See Also:
    • temporaryStorage

      public BUILDER temporaryStorage(TemporaryStorageConfig temporaryStorageConfig)
      Temporary storage to use across all classpath handlers. If not defined, a default one will be created.
      Parameters:
      temporaryStorageConfig - temporary storage
      Returns:
      updated builder instance
      See Also:
    • temporaryStorage

      public BUILDER temporaryStorage(Consumer<TemporaryStorageConfig.Builder> consumer)
      Temporary storage to use across all classpath handlers. If not defined, a default one will be created.
      Parameters:
      consumer - temporary storage
      Returns:
      updated builder instance
      See Also:
    • classpath

      public BUILDER classpath(List<? extends ClasspathHandlerConfig> classpath)
      List of classpath based static content handlers.
      Parameters:
      classpath - classpath handlers
      Returns:
      updated builder instance
      See Also:
    • addClasspath

      public BUILDER addClasspath(List<? extends ClasspathHandlerConfig> classpath)
      List of classpath based static content handlers.
      Parameters:
      classpath - classpath handlers
      Returns:
      updated builder instance
      See Also:
    • addClasspath

      public BUILDER addClasspath(ClasspathHandlerConfig classpath)
      List of classpath based static content handlers.
      Parameters:
      classpath - classpath handlers
      Returns:
      updated builder instance
      See Also:
    • addClasspath

      public BUILDER addClasspath(Consumer<ClasspathHandlerConfig.Builder> consumer)
      List of classpath based static content handlers.
      Parameters:
      consumer - classpath handlers
      Returns:
      updated builder instance
      See Also:
    • path

      public BUILDER path(List<? extends FileSystemHandlerConfig> path)
      List of file system based static content handlers.
      Parameters:
      path - path handlers
      Returns:
      updated builder instance
      See Also:
    • addPath

      public BUILDER addPath(List<? extends FileSystemHandlerConfig> path)
      List of file system based static content handlers.
      Parameters:
      path - path handlers
      Returns:
      updated builder instance
      See Also:
    • addPath

      public BUILDER addPath(FileSystemHandlerConfig path)
      List of file system based static content handlers.
      Parameters:
      path - path handlers
      Returns:
      updated builder instance
      See Also:
    • addPath

      public BUILDER addPath(Consumer<FileSystemHandlerConfig.Builder> consumer)
      List of file system based static content handlers.
      Parameters:
      consumer - path handlers
      Returns:
      updated builder instance
      See Also:
    • contentTypes

      public BUILDER contentTypes(Map<String,? extends MediaType> 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

      public BUILDER addContentTypes(Map<String,? extends MediaType> contentTypes)
      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

      public BUILDER putContentType(String key, MediaType contentType)
      This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      contentType - new value for the key
      Returns:
      updated builder instance
      See Also:
    • clearWelcome

      public BUILDER clearWelcome()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • welcome

      public BUILDER welcome(String welcome)
      Welcome-file name. Default for all handlers. By default, we do not serve default files.
      Parameters:
      welcome - welcome-file name, such as index.html
      Returns:
      updated builder instance
      See Also:
    • sockets

      public BUILDER sockets(Set<String> 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.

      Parameters:
      sockets - sockets to register this handler on
      Returns:
      updated builder instance
      See Also:
    • addSockets

      public BUILDER addSockets(Set<String> 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.

      Parameters:
      sockets - sockets to register this handler on
      Returns:
      updated builder instance
      See Also:
    • addSocket

      public BUILDER addSocket(String socket)
      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.

      Parameters:
      socket - sockets to register this handler on
      Returns:
      updated builder instance
      See Also:
    • enabled

      public boolean enabled()
      Whether this feature is enabled, defaults to true.
      Returns:
      the enabled
    • weight

      public double weight()
      Weight of the static content feature. Defaults to 95.0.
      Returns:
      the weight
    • name

      public String name()
      Name of this instance.
      Returns:
      the name
    • memoryCache

      public 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:
      the memory cache
    • temporaryStorage

      public Optional<TemporaryStorage> temporaryStorage()
      Temporary storage to use across all classpath handlers. If not defined, a default one will be created.
      Returns:
      the temporary storage
    • classpath

      public List<ClasspathHandlerConfig> classpath()
      List of classpath based static content handlers.
      Returns:
      the classpath
    • path

      public List<FileSystemHandlerConfig> path()
      List of file system based static content handlers.
      Returns:
      the path
    • contentTypes

      public Map<String,MediaType> contentTypes()
      Maps a filename extension to the response content type. To have a system-wide configuration, you can use the service loader SPI MediaTypeDetector.

      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:
      the content types
    • welcome

      public Optional<String> welcome()
      Welcome-file name. Default for all handlers. By default, we do not serve default files.
      Returns:
      the welcome
    • sockets

      public Set<String> 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:
      the sockets
    • config

      public Optional<Config> 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

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.