Package io.helidon.webserver
Class StaticContentSupport
- java.lang.Object
-
- io.helidon.webserver.StaticContentSupport
-
- All Implemented Interfaces:
Service
public class StaticContentSupport extends Object implements Service
Serves 'static content' (files) from filesystem or using a classloader to theWebServer
Routing
. It is possible toregister
it on the routing.// Server content of attached '/static/pictures' on '/pictures' Routing.builder() .register("/pics", StaticContentSupport.create("/static/pictures")) .build()
Content is served ONLY on HTTP
GET
method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StaticContentSupport.Builder
Fluent builder of the StaticContent detailed parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StaticContentSupport.Builder
builder(String resourceRoot)
Creates new builder with defined static content root as a class-loader resource.static StaticContentSupport.Builder
builder(String resourceRoot, ClassLoader classLoader)
Creates new builder with defined static content root as a class-loader resource.static StaticContentSupport.Builder
builder(Path root)
Creates new builder with defined static content root as a path to the file system.static StaticContentSupport
create(String resourceRoot)
Creates new instance with defined static content root as a class-loader resource.static StaticContentSupport
create(String resourceRoot, ClassLoader classLoader)
Creates new instance with defined static content root as a class-loader resource.static StaticContentSupport
create(Path root)
Creates new instance with defined static content root as a path to the file system.void
update(Routing.Rules routing)
UpdatesRouting.Rules
withhandlers
representing this service.
-
-
-
Method Detail
-
update
public void update(Routing.Rules routing)
Description copied from interface:Service
UpdatesRouting.Rules
withhandlers
representing this service.
-
builder
public static StaticContentSupport.Builder 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
- ifresourceRoot
attribute isnull
-
builder
public static StaticContentSupport.Builder 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
- ifresourceRoot
attribute isnull
-
builder
public static StaticContentSupport.Builder 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
- ifroot
attribute isnull
-
create
public 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
- ifresourceRoot
attribute isnull
-
create
public 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
- ifresourceRoot
attribute isnull
-
create
public 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
- ifroot
attribute isnull
-
-