implemented "Forward" path handler to catch lookups of former index.php

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-01-03 23:40:21 +01:00
parent fa8b5f2c57
commit 4bd4cf2f27
4 changed files with 26 additions and 7 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ dependencies {
implementation("de.srsoftware:configuration.api:1.0.0")
implementation("de.srsoftware:configuration.json:1.0.1")
implementation("de.srsoftware:tools.http:1.2.2")
implementation("de.srsoftware:tools.http:1.2.3")
implementation("de.srsoftware:tools.logging:1.2.0")
implementation("de.srsoftware:tools.plugin:1.0.1")
implementation("de.srsoftware:tools.util:1.3.0")
@@ -4,10 +4,7 @@ package de.srsoftware.cal.app;
import static java.lang.System.Logger.Level.*;
import com.sun.net.httpserver.HttpServer;
import de.srsoftware.cal.ApiEndpoint;
import de.srsoftware.cal.BaseImporter;
import de.srsoftware.cal.IndexHandler;
import de.srsoftware.cal.StaticHandler;
import de.srsoftware.cal.*;
import de.srsoftware.cal.db.Database;
import de.srsoftware.cal.db.MariaDB;
import de.srsoftware.configuration.Configuration;
@@ -64,7 +61,8 @@ public class Application {
HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
var staticPages = new StaticHandler(staticPath).bindPath("/static").on(server);
new IndexHandler(staticPages).bindPath("/").on(server);
new ApiEndpoint(db).bindPath(("/api")).on(server);
new ApiEndpoint(db).bindPath("/api").on(server);
new Forward().bindPath("/index.php").on(server);
server.start();
LOG.log(INFO,"Started webserver on port {0,number,#} …",port);