aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/BaseServlet.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-04 13:20:46 +1300
commitd4dbf85d9536bfec85252a58fc552e2bad42ff17 (patch)
tree4a849426c2cd60538b152138b147abef47b40966 /src/org/traccar/web/BaseServlet.java
parent9218bc65b9673b24d2866aae3d5bbe1a5388bab0 (diff)
downloadtrackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.gz
trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.tar.bz2
trackermap-server-d4dbf85d9536bfec85252a58fc552e2bad42ff17.zip
Remove trailing whitespaces from code
Diffstat (limited to 'src/org/traccar/web/BaseServlet.java')
-rw-r--r--src/org/traccar/web/BaseServlet.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/org/traccar/web/BaseServlet.java b/src/org/traccar/web/BaseServlet.java
index 97432e9fd..6e06e95ba 100644
--- a/src/org/traccar/web/BaseServlet.java
+++ b/src/org/traccar/web/BaseServlet.java
@@ -29,9 +29,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class BaseServlet extends HttpServlet {
-
+
public static final String USER_KEY = "user";
-
+
@Override
protected final void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String command = req.getPathInfo();
@@ -51,9 +51,9 @@ public abstract class BaseServlet extends HttpServlet {
sendResponse(resp.getWriter(), error);
}
}
-
+
protected abstract boolean handle(String command, HttpServletRequest req, HttpServletResponse resp) throws Exception;
-
+
public long getUserId(HttpServletRequest req) {
Long userId = (Long) req.getSession().getAttribute(USER_KEY);
if (userId == null) {
@@ -61,25 +61,25 @@ public abstract class BaseServlet extends HttpServlet {
}
return userId;
}
-
+
public void sendResponse(Writer writer, boolean success) throws IOException {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("success", success);
writer.write(result.build().toString());
}
-
+
public void sendResponse(Writer writer, JsonStructure json) throws IOException {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("success", true);
result.add("data", json);
writer.write(result.build().toString());
}
-
+
public void sendResponse(Writer writer, Exception error) throws IOException {
JsonObjectBuilder result = Json.createObjectBuilder();
result.add("success", false);
result.add("error", Log.exceptionStack(error));
writer.write(result.build().toString());
}
-
+
}