///////////////////////////////////////////////////////////////////////////////

    Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

///////////////////////////////////////////////////////////////////////////////

= Static Content Support
:description: Helidon Reactive WebServer static content support
:keywords: helidon, reactive, reactive streams, reactive java, reactive webserver

== Static Content Support

Use the `StaticContentSupport` class to serve files and classpath resources. 
`StaticContentSupport` can be created for any readable directory or classpath
 context root and registered on a path in `Routing`.

You can combine dynamic handlers with `StaticContentSupport` objects: if no file matches the request path, then the request is forwarded to
 the next handler. 

[source,java]
----
Routing.builder()
       .register("/pictures", StaticContentSupport.create(Paths.get("/some/WEB/pics")) // <1>
       .register("/", StaticContentSupport.builder("/static-content") // <2>
                                   .welcomeFileName("index.html") // <3>
                                   .build());
----
<1> Create a new `StaticContentSupport` object to serve data from the file system,
 and associate it with the `"/pictures"` context path.
<2> Create a `StaticContentSupport` object to serve resources from the contextual
 `ClassLoader`. The specific classloader can be also
    defined. A builder lets you provide more configuration values.
<3> `index.html` is the file that is returned if a directory is requested.

A `StaticContentSupport` object can be created using `create(...)` factory methods or a
 `builder`. The `builder` lets you provide more configuration values, including _welcome file-name_
 and mappings of filename extensions to media types.

