Class ServeStatic.Options

  • Enclosing class:
    ServeStatic

    public static class ServeStatic.Options
    extends java.lang.Object
    The options of ServeStatic.
    Since:
    1.1
    • Constructor Detail

      • Options

        public Options()
    • Method Detail

      • index

        public ServeStatic.Options index​(java.lang.String index)
        Set index.
        Parameters:
        index - the filename of the index
        Returns:
        this Options
      • indexes

        public ServeStatic.Options indexes​(java.lang.String... indexes)
        Set multiply indexes.
        Parameters:
        indexes - the array contains the filenames of the indexes
        Returns:
        this Options
      • showHidden

        public ServeStatic.Options showHidden()
        Allow clients to access hidden files.

        The default is false.

        Returns:
        this Options
      • showHidden

        public ServeStatic.Options showHidden​(boolean showHidden)
        Set if clients are allowed to access hidden files.

        The default is false.

        Parameters:
        showHidden - true to allow clients to access hidden files
        Returns:
        this Options
      • redirectDirectory

        public ServeStatic.Options redirectDirectory​(boolean redirectDirectory)
        Set if redirect to trailing "/" when the pathname is a directory or not.

        The default is true.

        Parameters:
        redirectDirectory - false to disable
        Returns:
        this Options
      • cacheControl

        public ServeStatic.Options cacheControl​(java.lang.String cacheControl)
        Set cacheControl.

        The default is "no-cache".

        Parameters:
        cacheControl - the value of the cache-control
        Returns:
        this Options
      • etag

        public ServeStatic.Options etag​(boolean etag)
        Set if E-TAG is enabled or not.

        The default is true.

        Parameters:
        etag - false to disable E-TEG feature
        Returns:
        this Options
      • lastModified

        public ServeStatic.Options lastModified​(boolean lastModified)
        Set if header last-modified is enabled or not.

        The default is true.

        Parameters:
        lastModified - false to disable last-modified header
        Returns:
        this Options
      • addHeaders

        public ServeStatic.Options addHeaders​(java.util.function.Consumer<io.netty.handler.codec.http.HttpHeaders> addHeaders)
        Set the function set custom headers on response.
        Parameters:
        addHeaders - the function set custom headers on response
        Returns:
        this Options
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object