Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 2.29 KB

jstatic.md

File metadata and controls

63 lines (44 loc) · 2.29 KB

The files for the static web can be embedded or in a directory. The embedded resources are cached at startup!

Every static page group must implement "org.kendar.http.StaticWebFilter" with the following methods

  • String getId(): To return an unique identifier
  • String getPath(): To return where should find the pages

Some annotation must be added too, Component (for Spring Boot) and the HttpTypeFilter, specifying the host that will answer. It supports properties replacement with the "$" sign syntax. The name of variable is the path in json config

@Component
@HttpTypeFilter(hostAddress = "${global.localAddress}")

Of course you must register the dns and the certificate

Static web pages logic

Suppose the following directory structure with the address www.test.org

index.html
sub
    index.htm
    test.htm

Then calling

Implementations

Real directory

Should return the path of the directory where are located the pages, if it's not an absolute path will be relative to the main application jar

Embedded resources

This will be cached at startup!

With a relative path and with a "*" prefix the StaticWebFilter will search for all the resource files inside the StaticWebFilter implementation JAR. If you create for example a StaticWebFilter with a "*web" path, this means that under "src/resources/web" there will be the HttpTypeFilter hostAddress root.

Suppose your hostAddress is "www.test.com" and a resources exists "src/resources/web/test.html" then calling "https://www.test.com/test.html" you'll get the page!