From abb2f8614b7fbc25892e277b55fa216c7d81fd54 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 13 Jul 2015 22:38:13 +1200 Subject: Use switch statemens with strings --- src/org/traccar/http/ServerServlet.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/org/traccar/http/ServerServlet.java') diff --git a/src/org/traccar/http/ServerServlet.java b/src/org/traccar/http/ServerServlet.java index d814769a8..836a109fc 100644 --- a/src/org/traccar/http/ServerServlet.java +++ b/src/org/traccar/http/ServerServlet.java @@ -24,14 +24,18 @@ public class ServerServlet extends BaseServlet { @Override protected boolean handle(String command, HttpServletRequest req, HttpServletResponse resp) throws Exception { - if (command.equals("/get")) { - get(req, resp); - } else if (command.equals("/update")) { - update(req, resp); - } else { - return false; + + switch (command) { + case "/get": + get(req, resp); + break; + case "/update": + update(req, resp); + break; + default: + return false; } - return true; + return true; } private void get(HttpServletRequest req, HttpServletResponse resp) throws Exception { -- cgit v1.2.3