Class StaticContentService.Builder<B extends StaticContentService.Builder<B>>

Type Parameters:
B - type of a subclass of a concrete builder
All Implemented Interfaces:
Builder<B,StaticContentService>, Supplier<StaticContentService>
Direct Known Subclasses:
Enclosing interface:

public abstract static class StaticContentService.Builder<B extends StaticContentService.Builder<B>> extends Object implements Builder<B,StaticContentService>
Fluent builder of the StaticContent detailed parameters.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor.
  • Method Details

    • build

      public final StaticContentService build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<B extends StaticContentService.Builder<B>,StaticContentService>
      instance of the built type
    • welcomeFileName

      public B welcomeFileName(String welcomeFileName)
      Sets a name of the "file" which will be returned if directory is requested.
      welcomeFileName - a name of the welcome file
      updated builder
    • pathMapper

      public B pathMapper(Function<String,String> resolvePathFunction)
      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.
      resolvePathFunction - function
      updated builder
    • addCacheInMemory

      public B addCacheInMemory(String path)
      Add a path (as requested by the user) that should be cached in memory. The resource will be loaded into memory (as bytes) on server startup and served from memory, instead of accessing the resource each time. For classpath, each file must be explicitly specified (as we do not scan classpath), for file based this can also include directories. Helidon does not validate amount of memory used, be careful to have enough heap memory to cache the configured files.

      Files cached in memory will never be re-loaded, even if changed, until server restart!

      For classpath resource served from web/index.html, the path should be configured to index.html when the classpath root is set to web.

      path - path to cache in memory
      updated builder
    • recordCacheCapacity

      public B recordCacheCapacity(int capacity)
      Configure capacity of cache used for resources. This cache will make sure the media type and location is discovered faster.
      capacity - maximal number of cached records, only caches media type and Path, not the content
      updated builder
    • doBuild

      protected abstract StaticContentService doBuild()
      Build the actual instance.
      static content support