Class HttpFileBuilder

java.lang.Object
com.linecorp.armeria.server.file.AbstractHttpFileBuilder
com.linecorp.armeria.server.file.HttpFileBuilder

public abstract class HttpFileBuilder extends AbstractHttpFileBuilder
Builds an HttpFile from a file, a classpath resource or an HttpData.

 // Build from a file.
 HttpFile f = HttpFile.builder(Paths.get("/var/www/index.html"))
                      .lastModified(false)
                      .setHeader(HttpHeaderNames.CONTENT_LANGUAGE, "en-US")
                      .build();

 // Build from a classpath resource.
 HttpFile f = HttpFile.builder(MyClass.class.getClassLoader(), "/foo.txt.gz")
                      .setHeader(HttpHeaderNames.CONTENT_ENCODING, "gzip")
                      .build();

 // Build from an HttpData.
 HttpFile f = HttpFile.builder(HttpData.ofUtf8("content"), System.currentTimeMillis())
                      .entityTag((pathOrUri, attrs) -> "myCustomEntityTag")
                      .build();