add 404 page

This commit is contained in:
andrzej 2024-11-11 12:30:50 +01:00
parent 4ac130b9d2
commit 61777d5581
2 changed files with 10 additions and 2 deletions

9
404.html Normal file
View File

@ -0,0 +1,9 @@
<html>
<head>
<title>404</title>
</head>
<body>
<h1>UH-OH</h1>
<p>The page you were looking for could not be found.</p>
</body>
</html>

View File

@ -79,8 +79,7 @@ public class Main {
sendResponse(client, "200 OK", contentType, Files.readAllBytes(filepath));
} else {
// 404
byte[] notFoundContent = "<h1>404 Something went wrong</h1>".getBytes();
sendResponse(client, "404 Not Found", "text/html", notFoundContent);
sendResponse(client, "404 Not Found", "text/html", Files.readAllBytes(getFilePath("404.html")));
}
}