aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/http/MainServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/http/MainServlet.java')
-rw-r--r--src/org/traccar/http/MainServlet.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/http/MainServlet.java b/src/org/traccar/http/MainServlet.java
index 8fa0a13af..036c472f8 100644
--- a/src/org/traccar/http/MainServlet.java
+++ b/src/org/traccar/http/MainServlet.java
@@ -20,6 +20,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.traccar.Context;
+import org.traccar.model.User;
public class MainServlet extends BaseServlet {
@@ -31,6 +32,8 @@ public class MainServlet extends BaseServlet {
login(req, resp);
} else if (command.equals("/logout")) {
logout(req, resp);
+ } else if (command.equals("/register")) {
+ register(req, resp);
} else {
return false;
}
@@ -52,4 +55,10 @@ public class MainServlet extends BaseServlet {
sendResponse(resp.getWriter());
}
+ private void register(HttpServletRequest req, HttpServletResponse resp) throws Exception {
+ User user = JsonConverter.objectFromJson(req.getReader(), new User());
+ Context.getDataManager().addUser(user);
+ sendResponse(resp.getWriter());
+ }
+
}