jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r1170083 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
Date Tue, 13 Sep 2011 08:30:57 GMT
Author: dpfister
Date: Tue Sep 13 08:30:57 2011
New Revision: 1170083

URL: http://svn.apache.org/viewvc?rev=1170083&view=rev
Log:
HTTP interface to microkernel
- pretty print JSON

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java?rev=1170083&r1=1170082&r2=1170083&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
Tue Sep 13 08:30:57 2011
@@ -26,6 +26,7 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
+import org.apache.jackrabbit.mk.json.JsopBuilder;
 import org.apache.jackrabbit.mk.util.MicroKernelInputStream;
 import org.apache.jackrabbit.mk.util.IOUtils;
 
@@ -108,7 +109,8 @@ class MicroKernelServlet implements Serv
             int maxEntries = request.getParameter("max_entries", 10);
 
             response.setContentType("text/plain");
-            response.getOutputStream().write(mk.getRevisions(since, maxEntries).getBytes());
+            String json = mk.getRevisions(since, maxEntries);
+            response.getOutputStream().write(JsopBuilder.prettyPrint(json).getBytes());
         }        
     }
     
@@ -146,7 +148,8 @@ class MicroKernelServlet implements Serv
             String toRevisionId = request.getParameter("to_revision_id", headRevision);
 
             response.setContentType("text/plain");
-            response.getOutputStream().write(mk.getJournal(fromRevisionId, toRevisionId).getBytes());
+            String json = mk.getJournal(fromRevisionId, toRevisionId);
+            response.getOutputStream().write(JsopBuilder.prettyPrint(json).getBytes());
         }        
     }
 
@@ -179,7 +182,8 @@ class MicroKernelServlet implements Serv
             int count = request.getParameter("count", -1);
             
             response.setContentType("text/plain");
-            response.getOutputStream().write(mk.getNodes(path, revisionId, depth, offset,
count).getBytes());
+            String json = mk.getNodes(path, revisionId, depth, offset, count);
+            response.getOutputStream().write(JsopBuilder.prettyPrint(json).getBytes());
         }        
     }
 



Mime
View raw message