diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/http/MainServlet.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/org/traccar/http/MainServlet.java b/src/org/traccar/http/MainServlet.java index 10920accb..4dc02e81f 100644 --- a/src/org/traccar/http/MainServlet.java +++ b/src/org/traccar/http/MainServlet.java @@ -53,6 +53,8 @@ public class MainServlet extends HttpServlet { resp.sendError(HttpServletResponse.SC_BAD_REQUEST); } else if (command.equals("/async")) { async(req.startAsync()); + } else if (command.equals("/session")) { + session(req, resp); } else if (command.equals("/login")) { login(req, resp); } else if (command.equals("/logout")) { @@ -211,6 +213,10 @@ public class MainServlet extends HttpServlet { } } + private void session(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.getWriter().println("{ success: true, session: " + (req.getSession().getAttribute(USER_ID) != null) + " }"); + } + private void login(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { req.getSession().setAttribute(USER_ID, |