edited stuff (#50)

This commit is contained in:
Valentin Heiserer
2024-04-23 23:27:01 +02:00
committed by GitHub
parent b8b89ee696
commit 2e5a42b6d3
8 changed files with 62 additions and 47 deletions

View File

@@ -48,13 +48,15 @@ public class BackendServer implements MessageSender {
// Configure CORS settings
configureCors(context);
URL webContentUrl = getClass().getClassLoader().getResource("web-content");
if (webContentUrl == null) {
throw new RuntimeException("Unable to find 'web-content' directory");
if (openFrontend) {
URL webContentUrl = getClass().getClassLoader().getResource("web-content");
if (webContentUrl == null) {
throw new RuntimeException("Unable to find 'web-content' directory");
}
String webContentPath = webContentUrl.toExternalForm();
context.setResourceBase(webContentPath);
context.addServlet(new ServletHolder("frontend", DefaultServlet.class), "/");
}
String webContentPath = webContentUrl.toExternalForm();
context.setResourceBase(webContentPath);
context.addServlet(new ServletHolder("frontend", DefaultServlet.class), "/");
// Configure specific websocket behavior
JettyWebSocketServletContainerInitializer.configure(