Interface ServeStatic.EtagGenerator

  • Enclosing class:
    ServeStatic
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public static interface ServeStatic.EtagGenerator
    Function to generates E-TAGs.
    Since:
    1.1
    • Field Detail

      • BASIC

        static final ServeStatic.EtagGenerator BASIC
        The basic generator.

        Algorithm:

         "${hex(file.lastModifiedInSeconds)}-${hex(file.size)}"
         
    • Method Detail

      • week

        default boolean week()
        Returns true if is weak validator, otherwise false
        Returns:
        true if is weak validator, otherwise false
      • generate

        java.lang.String generate​(java.nio.file.Path path,
                                  java.nio.file.attribute.BasicFileAttributes fileAttributes)
                           throws java.io.IOException
        Generate the E-TAG.
        Parameters:
        path - the path of the file
        fileAttributes - the basic attributes associated with the file
        Returns:
        the E-TAG string
        Throws:
        java.io.IOException - if any IO error occurs