aboutsummaryrefslogtreecommitdiff
path: root/src
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
parentfe599125befa708ec3547b591918effe2ff9beb8 (diff)
downloadtraccar-server-eadf492fe75fcfb0da617c9bc66bddd03139c96e.tar.gz
traccar-server-eadf492fe75fcfb0da617c9bc66bddd03139c96e.tar.bz2
traccar-server-eadf492fe75fcfb0da617c9bc66bddd03139c96e.zip
Minor refactoring in web server class
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/api/SecurityRequestFilter.java1
-rw-r--r--src/org/traccar/web/WebServer.java34
2 files changed, 12 insertions, 23 deletions
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