From eadf492fe75fcfb0da617c9bc66bddd03139c96e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 2 Dec 2015 10:50:21 +1300 Subject: Minor refactoring in web server class --- src/org/traccar/api/SecurityRequestFilter.java | 1 - src/org/traccar/web/WebServer.java | 34 +++++++++----------------- 2 files changed, 12 insertions(+), 23 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java index d4f685000..5f4d2332f 100644 --- a/src/org/traccar/api/SecurityRequestFilter.java +++ b/src/org/traccar/api/SecurityRequestFilter.java @@ -20,7 +20,6 @@ import org.traccar.api.resource.SessionResource; import org.traccar.model.User; import java.nio.charset.Charset; -import java.security.Security; import java.sql.SQLException; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Path; diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index ad40e246f..82a695e96 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -35,9 +35,6 @@ import org.traccar.api.resource.SessionResource; import org.traccar.api.resource.UserResource; import org.traccar.helper.Log; -/** - * Integrated HTTP server - */ public class WebServer { private Server server; @@ -63,21 +60,19 @@ public class WebServer { initServer(); switch (config.getString("web.type", "new")) { case "api": - initApi(); - break; - case "new": - initApi(); - if (config.getBoolean("web.console")) { - initConsole(); - } - initWebApp(); + initOldApi(); break; case "old": - initApi(); + initOldApi(); + initRestApi(); initOldWebApp(); break; default: - Log.error("Unsupported web application type: " + config.getString("web.type")); + initRestApi(); + if (config.getBoolean("web.console")) { + initConsole(); + } + initWebApp(); break; } server.setHandler(handlers); @@ -102,15 +97,10 @@ public class WebServer { Log.warning(error); } - WebAppContext webapp = new WebAppContext(); - webapp.setContextPath("/"); - webapp.setWar(config.getString("web.application")); - handlers.addHandler(webapp); - } - - private void initApi() { - initOldApi(); - initRestApi(); + WebAppContext app = new WebAppContext(); + app.setContextPath("/"); + app.setWar(config.getString("web.application")); + handlers.addHandler(app); } @Deprecated -- cgit v1.2.3