All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.example.http.hello.StaticFileDemo Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.firefly.example.http.hello;

import com.firefly.$;
import com.firefly.server.http2.router.handler.file.StaticFileHandler;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * @author Pengtao Qiu
 */
public class StaticFileDemo {
    public static void main(String[] args) throws Exception {
        Path path = Paths.get(StaticFileDemo.class.getResource("/").toURI());
        $.httpsServer().router().get("/static/*")
         .handler(new StaticFileHandler(path.toAbsolutePath().toString()))
         .listen("localhost", 8080);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy