Interface StaticContentSupport
-
- All Superinterfaces:
Service
public interface StaticContentSupport extends Service
Serves 'static content' (files) from filesystem or using a classloader to theWebServerRouting. It is possible toregisterit on the routing.// Serve content of attached '/static/pictures' on '/pics' Routing.builder() .register("/pics", StaticContentSupport.create("/static/pictures")) .build()Content is served ONLY on HTTP
GETmethod.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classStaticContentSupport.Builder<B extends StaticContentSupport.Builder<B>>Fluent builder of the StaticContent detailed parameters.static classStaticContentSupport.ClassPathBuilderBuilder for class path based static content.static classStaticContentSupport.FileBasedBuilder<T extends StaticContentSupport.FileBasedBuilder<T>>Builder for file based static content supports, such as file based and classpath based.static classStaticContentSupport.FileSystemBuilderBuilder for file system based static content.
-
Method Summary
Static Methods Modifier and Type Method Description static StaticContentSupport.ClassPathBuilderbuilder(String resourceRoot)Creates new builder with defined static content root as a class-loader resource.static StaticContentSupport.ClassPathBuilderbuilder(String resourceRoot, ClassLoader classLoader)Creates new builder with defined static content root as a class-loader resource.static StaticContentSupport.FileSystemBuilderbuilder(Path root)Creates new builder with defined static content root as a path to the file system.static StaticContentSupportcreate(String resourceRoot)Creates new instance with defined static content root as a class-loader resource.static StaticContentSupportcreate(String resourceRoot, ClassLoader classLoader)Creates new instance with defined static content root as a class-loader resource.static StaticContentSupportcreate(Path root)Creates new instance with defined static content root as a path to the file system.
-
-
-
Method Detail
-
builder
static StaticContentSupport.ClassPathBuilder builder(String resourceRoot)
Creates new builder with defined static content root as a class-loader resource. Builder provides ability to define more advanced configuration.Current context classloader is used to load static content.
- Parameters:
resourceRoot- a root resource path.- Returns:
- a builder
- Throws:
NullPointerException- ifresourceRootattribute isnull
-
builder
static StaticContentSupport.ClassPathBuilder builder(String resourceRoot, ClassLoader classLoader)
Creates new builder with defined static content root as a class-loader resource. Builder provides ability to define more advanced configuration.- Parameters:
resourceRoot- a root resource path.classLoader- a class-loader for the static content- Returns:
- a builder
- Throws:
NullPointerException- ifresourceRootattribute isnull
-
builder
static StaticContentSupport.FileSystemBuilder builder(Path root)
Creates new builder with defined static content root as a path to the file system. Builder provides ability to define more advanced configuration.- Parameters:
root- a root path.- Returns:
- a builder
- Throws:
NullPointerException- ifrootattribute isnull
-
create
static StaticContentSupport create(String resourceRoot)
Creates new instance with defined static content root as a class-loader resource.Current context classloader is used to load static content.
- Parameters:
resourceRoot- a root resource path.- Returns:
- created instance
- Throws:
NullPointerException- ifresourceRootattribute isnull
-
create
static StaticContentSupport create(String resourceRoot, ClassLoader classLoader)
Creates new instance with defined static content root as a class-loader resource.- Parameters:
resourceRoot- a root resource path.classLoader- a class-loader for the static content- Returns:
- created instance
- Throws:
NullPointerException- ifresourceRootattribute isnull
-
create
static StaticContentSupport create(Path root)
Creates new instance with defined static content root as a path to the file system.- Parameters:
root- a root path.- Returns:
- created instance
- Throws:
NullPointerException- ifrootattribute isnull
-
-