asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject asterixdb git commit: log request in QueryServiceServlet
Date Fri, 30 Sep 2016 23:04:08 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 68c6a997c -> 45c3304e7


log request in QueryServiceServlet

Change-Id: Iceb265553bd20f4ab964a769892169f2c62e44a4
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1232
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/45c3304e
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/45c3304e
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/45c3304e

Branch: refs/heads/master
Commit: 45c3304e7868a3f69faab0368b5cb3273989cd71
Parents: 68c6a99
Author: Till Westmann <tillw@apache.org>
Authored: Fri Sep 30 11:59:59 2016 -0700
Committer: Till Westmann <tillw@apache.org>
Committed: Fri Sep 30 16:03:32 2016 -0700

----------------------------------------------------------------------
 .../api/http/servlet/QueryServiceServlet.java     | 18 ++++++++++++++++++
 .../org/apache/asterix/common/utils/JSONUtil.java |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/45c3304e/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
index c7adc25..427e177 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/QueryServiceServlet.java
@@ -226,6 +226,23 @@ public class QueryServiceServlet extends HttpServlet {
         String format;
         boolean pretty;
         String clientContextID;
+
+        @Override
+        public String toString() {
+            return append(new StringBuilder()).toString();
+        }
+
+        public StringBuilder append(final StringBuilder sb) {
+            sb.append("{ ");
+            sb.append("\"statement\": \"");
+            JSONUtil.escape(sb, statement);
+            sb.append("\", ");
+            sb.append("\"format\": \"").append(format).append("\", ");
+            sb.append("\"pretty\": ").append(pretty).append(", ");
+            sb.append("\"clientContextID\": \"").append(clientContextID).append("\" ");
+            sb.append('}');
+            return sb;
+        }
     }
 
     private static String getParameterValue(String content, String attribute) {
@@ -426,6 +443,7 @@ public class QueryServiceServlet extends HttpServlet {
     }
 
     private void handleRequest(RequestParameters param, HttpServletResponse response) throws
IOException {
+        LOGGER.info(param.toString());
         long elapsedStart = System.nanoTime();
         final StringWriter stringWriter = new StringWriter();
         final PrintWriter resultWriter = new PrintWriter(stringWriter);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/45c3304e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
index 0b973e1..fd89c5e 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/JSONUtil.java
@@ -112,7 +112,7 @@ public class JSONUtil {
         return escape(new StringBuilder(), str).toString();
     }
 
-    private static StringBuilder escape(StringBuilder sb, String str) {
+    public static StringBuilder escape(StringBuilder sb, String str) {
         for (int i = 0; i < str.length(); ++i) {
             appendEsc(sb, str.charAt(i));
         }


Mime
View raw message