use of io.helidon.webserver.staticcontent.StaticContentSupport in project helidon by oracle.
the class ServerCdiExtension method registerClasspathStaticContent.
private void registerClasspathStaticContent(Config config) {
Config context = config.get("context");
StaticContentSupport.ClassPathBuilder cpBuilder = StaticContentSupport.builder(config.get("location").asString().get());
cpBuilder.welcomeFileName(config.get("welcome").asString().orElse("index.html"));
config.get("tmp-dir").as(Path.class).ifPresent(cpBuilder::tmpDir);
StaticContentSupport staticContent = cpBuilder.build();
if (context.exists()) {
routingBuilder.register(context.asString().get(), staticContent);
} else {
routingBuilder.register(staticContent);
}
STARTUP_LOGGER.finest("Static classpath");
}
use of io.helidon.webserver.staticcontent.StaticContentSupport in project helidon by oracle.
the class ServerCdiExtension method registerPathStaticContent.
private void registerPathStaticContent(Config config) {
Config context = config.get("context");
StaticContentSupport.FileSystemBuilder pBuilder = StaticContentSupport.builder(config.get("location").as(Path.class).get());
config.get("welcome").asString().ifPresent(pBuilder::welcomeFileName);
StaticContentSupport staticContent = pBuilder.build();
if (context.exists()) {
routingBuilder.register(context.asString().get(), staticContent);
} else {
routingBuilder.register(staticContent);
}
STARTUP_LOGGER.finest("Static path");
}
use of io.helidon.webserver.staticcontent.StaticContentSupport in project helidon by oracle.
the class Gh2631 method routing.
private static Routing routing() {
StaticContentSupport classpath = StaticContentSupport.builder("web").welcomeFileName("index.txt").build();
StaticContentSupport file = StaticContentSupport.builder(Paths.get("src/main/resources/web")).welcomeFileName("index.txt").build();
return Routing.builder().register("/simple", classpath).register("/fallback", classpath).register("/fallback", StaticContentSupport.builder("fallback").pathMapper(path -> "index.txt").build()).register("/simpleFile", file).register("/fallbackFile", file).register("/fallbackFile", StaticContentSupport.builder(Paths.get("src/main/resources/fallback")).pathMapper(path -> "index.txt").build()).build();
}
Aggregations