added router to svelte

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-06-30 22:55:13 +02:00
parent b918d453cb
commit 56cdedcdb8
8 changed files with 55 additions and 30 deletions

View File

@@ -13,9 +13,12 @@ import java.io.IOException;
public class WebHandler extends PathHandler {
@Override
public boolean doGet(Path path, HttpExchange ex) throws IOException {
LOG.log(DEBUG,"doGet({0},ex)",path);
if (path.empty()) {
// we always need to load the index.html first, when we encounter something like /module/entry/4/view
// the index page itself references required elements with absolute path: /assets/index-x.js
var first = path.isEmpty() ? null : path.firstElement();
if (first == null || !first.contains(".")){
path.clear();
path.push("index.html");
}
var url = getClass().getClassLoader().getResource("web/"+path);