Could someone tell me why using the following code:
Undertow server = Undertow.builder() .addHttpListener(8080, "0.0.0.0") .setHandler(path().addPrefixPath("/", resource(new ClassPathResourceManager( HelloWorldServer.class.getClassLoader())) .addWelcomeFiles("index.html"))) .build(); server.start(); would then give you a blank page when going to the URL http://localhost:8080
but works correctly for the URL http://localhost:8080/index.html
I was under the impression that the PrefixPath of "/" should redirect all default requests to the welcome file you define but that doesn't appear to be the case. Note: the index.html file is embedded in the jar file on the root path. Verified it's there and can extract it from the ClassPathResourceManager.
I have also tried to define a different PrefixPath other than "/" but the welcome file never gets triggered by default. I always have to define it in the URL. Much appreciate some help in my understanding!