Class StaticFiles.Builder

java.lang.Object
org.apache.juneau.BeanBuilder<StaticFiles>
org.apache.juneau.rest.staticfile.StaticFiles.Builder
Enclosing interface:
StaticFiles

public static class StaticFiles.Builder extends BeanBuilder<StaticFiles>
Builder class.
  • Constructor Details

    • Builder

      protected Builder(BeanStore beanStore)
      Constructor.
      Parameters:
      beanStore - The bean store to use for creating beans.
  • Method Details

    • buildDefault

      Description copied from class: BeanBuilder
      Creates the bean when the bean type is null or is the default value.
      Overrides:
      buildDefault in class BeanBuilder<StaticFiles>
      Returns:
      A new bean.
    • headers

      public StaticFiles.Builder headers(Header... headers)
      Appends headers to add to HTTP responses.

      Can be called multiple times to add multiple headers.

      Parameters:
      headers - The headers to add.
      Returns:
      This object.
    • addMimeTypes

      Prepend the MIME type values to the MIME types registry.
      Parameters:
      mimeTypes - A .mime.types formatted string of entries. See MimetypesFileTypeMap.addMimeTypes(String).
      Returns:
      This object.
    • mimeTypes

      Replaces the MIME types registry used for determining content types.
      Parameters:
      mimeTypes - The new MIME types registry.
      Returns:
      This object.
    • caching

      public StaticFiles.Builder caching(long cachingLimit)
      Enables in-memory caching of files for quicker retrieval.
      Parameters:
      cachingLimit - The maximum file size in bytes.
      Returns:
      This object.
    • cp

      public StaticFiles.Builder cp(Class<?> c, String path, boolean recursive)
      Adds a class subpackage to the lookup paths.
      Parameters:
      c - The class whose package will be added to the lookup paths. Must not be null.
      path - The absolute or relative subpath.
      recursive - If true, also recursively adds all the paths of the parent classes as well.
      Returns:
      This object.
    • dir

      Adds a file system directory to the lookup paths.
      Parameters:
      path - The path relative to the working directory. Must not be null
      Returns:
      This object.
    • exclude

      public StaticFiles.Builder exclude(String... patterns)
      Specifies the regular expression file name pattern to use to exclude files from being retrieved from the file source.
      Parameters:
      patterns - The regular expression exclude patterns.
      If none are specified, no files will be excluded.
      Returns:
      This object.
    • include

      public StaticFiles.Builder include(String... patterns)
      Specifies the regular expression file name patterns to use to include files being retrieved from the file source.
      Parameters:
      patterns - The regular expression include patterns.
      The default is ".*".
      Returns:
      This object.
    • path

      public StaticFiles.Builder path(Path path)
      Adds a file system directory to the lookup paths.
      Parameters:
      path - The directory path.
      Returns:
      This object.
    • impl

      Description copied from class: BeanBuilder
      Overrides the bean returned by the BeanBuilder.build() method.

      Use this method if you want this builder to return an already-instantiated bean.

      Overrides:
      impl in class BeanBuilder<StaticFiles>
      Parameters:
      value - The setting value.
      Returns:
      This object.
    • type

      public StaticFiles.Builder type(Class<?> value)
      Description copied from class: BeanBuilder
      Overrides the bean type produced by the BeanBuilder.build() method.

      Use this method if you want to instantiated a bean subclass.

      Overrides:
      type in class BeanBuilder<StaticFiles>
      Parameters:
      value - The setting value.
      Returns:
      This object.