Class BaseHandlerConfig.BuilderBase.BaseHandlerConfigImpl

java.lang.Object
io.helidon.webserver.staticcontent.BaseHandlerConfig.BuilderBase.BaseHandlerConfigImpl
All Implemented Interfaces:
Prototype.Api, BaseHandlerConfig
Direct Known Subclasses:
ClasspathHandlerConfig.BuilderBase.ClasspathHandlerConfigImpl, FileSystemHandlerConfig.BuilderBase.FileSystemHandlerConfigImpl
Enclosing class:
BaseHandlerConfig.BuilderBase<BUILDER extends BaseHandlerConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends BaseHandlerConfig>

protected static class BaseHandlerConfig.BuilderBase.BaseHandlerConfigImpl extends Object implements BaseHandlerConfig
Generated implementation of the prototype, can be extended by descendant prototype implementations.
  • Constructor Details

    • BaseHandlerConfigImpl

      protected BaseHandlerConfigImpl(BaseHandlerConfig.BuilderBase<?,?> builder)
      Create an instance providing a builder.
      Parameters:
      builder - extending builder base of this prototype
  • Method Details

    • enabled

      public boolean enabled()
      Description copied from interface: BaseHandlerConfig
      Whether this handle is enabled, defaults to true.
      Specified by:
      enabled in interface BaseHandlerConfig
      Returns:
      whether enabled
    • context

      public String context()
      Description copied from interface: BaseHandlerConfig
      Context that will serve this handler's static resources, defaults to /.
      Specified by:
      context in interface BaseHandlerConfig
      Returns:
      context under webserver
    • sockets

      public Set<String> sockets()
      Description copied from interface: BaseHandlerConfig
      Sockets names (listeners) that will host this static content handler, defaults to all configured sockets. Default socket name is @default.
      Specified by:
      sockets in interface BaseHandlerConfig
      Returns:
      sockets to register this handler on
    • welcome

      public Optional<String> welcome()
      Description copied from interface: BaseHandlerConfig
      Welcome-file name. In case a directory is requested, this file would be served if present. There is no welcome file by default.
      Specified by:
      welcome in interface BaseHandlerConfig
      Returns:
      welcome-file name, such as index.html
    • cachedFiles

      public Set<String> cachedFiles()
      Description copied from interface: BaseHandlerConfig
      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!

      Specified by:
      cachedFiles in interface BaseHandlerConfig
      Returns:
      set of file names (or directory names if not using classpath) to cache in memory on startup
    • memoryCache

      public Optional<MemoryCache> memoryCache()
      Description copied from interface: BaseHandlerConfig
      Handles will use memory cache configured on StaticContentConfig.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.

      Specified by:
      memoryCache in interface BaseHandlerConfig
      Returns:
      memory cache to use with this handler
    • contentTypes

      public Map<String, MediaType> contentTypes()
      Description copied from interface: BaseHandlerConfig
      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 on the StaticContentConfig and here when used from configuration.

      Specified by:
      contentTypes in interface BaseHandlerConfig
      Returns:
      map of file extensions to associated media type
    • pathMapper

      public Function<String,String> pathMapper()
      Description copied from interface: BaseHandlerConfig
      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.
      Specified by:
      pathMapper in interface BaseHandlerConfig
      Returns:
      function to map request path to resource path
    • recordCacheCapacity

      public Optional<Integer> recordCacheCapacity()
      Description copied from interface: BaseHandlerConfig
      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()

      Specified by:
      recordCacheCapacity in interface BaseHandlerConfig
      Returns:
      maximal number of cached records; records do not contain the content bytes
    • preCompressedEnabled

      public Optional<Boolean> preCompressedEnabled()
      Description copied from interface: BaseHandlerConfig
      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.
      Specified by:
      preCompressedEnabled in interface BaseHandlerConfig
      Returns:
      whether pre-compressed sidecar resources should be used
    • preCompressedEncodings

      public Optional<Map<String,String>> preCompressedEncodings()
      Description copied from interface: BaseHandlerConfig
      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 than identity and *, and suffixes have leading dots ignored and must not contain path separators.
      Specified by:
      preCompressedEncodings in interface BaseHandlerConfig
      Returns:
      content coding to file suffix mappings
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object