application.properties:
quarkus.http.static-resources.index-page=/html/index.html
this has "html" prefix so all html files are in META-INF/resources/html/
@ApplicationScoped
public class GeneralRouter {
@Route(path = "/")
public void getIndex(RoutingContext rc) {
StaticHandler.create(FileSystemAccess.ROOT, "immaterial.html").handle(rc);
}
its immaterial what html file is defined here as quarkus.http.static-resources.index-page will be returned regardless. However if one omits the StaticHandler.create(....) the request never returns. The default ROOT is main/resources/META-INF/resources/ for the index call. Even if "index.html" is defined instead of "immaterial.html", its misleading as that code is not utilized to return the index file.
@Route(path = "leftNav")
public void getLeftNav(RoutingContext rc) {
StaticHandler.create(FileSystemAccess.RELATIVE, "/META-INF/resources/html/leftNav.html").handle(rc);
}
}
for this request the root is main/resources/ (RELATIVE and ROOT path will look the same). Thus to return this file the path is different than for index.html
seems there used to be the config. property: quarkus.http.static-asset=/whatever but that setting is no longer available.
interestingly, js/css is served relative to the index's root: main/resources/META-INF/resources/
further confusing things, StaticHandler interface has String DEFAULT_WEB_ROOT = "webroot";
documentation reads:
By default, Quarkus will serve content from under the root context. If you want to change this you can use the quarkus.http.root-path config key to set the context path.
But that is not correct as that path (abc as example) is used in the url,
127.0.0.1:8080/abc/ but that has no effect on what directory the webserver serves files from.
in a perfect world, one would define a webroot under main/resources/ using a config property and leave META-INF (and its duplicative "resources" sub dir) to manifest.inf type files.
I'm sure this all seems sophomoric, but devs are usually pretty particular about how they organize their static files and these "isms" can be frustrating and overly verbose to navigate.
thx for the read