aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/WebServer.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-02 10:50:21 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-02 10:50:21 +1300
commiteadf492fe75fcfb0da617c9bc66bddd03139c96e (patch)
tree65837e727883a435b2c0e0ab2d330817b02b3fd5 /src/org/traccar/web/WebServer.java
parentfe599125befa708ec3547b591918effe2ff9beb8 (diff)
downloadtrackermap-server-eadf492fe75fcfb0da617c9bc66bddd03139c96e.tar.gz
trackermap-server-eadf492fe75fcfb0da617c9bc66bddd03139c96e.tar.bz2
trackermap-server-eadf492fe75fcfb0da617c9bc66bddd03139c96e.zip
Minor refactoring in web server class
Diffstat (limited to 'src/org/traccar/web/WebServer.java')
-rw-r--r--src/org/traccar/web/WebServer.java34
1 files changed, 12 insertions, 22 deletions
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