Kaynağa Gözat

verify Fixed servlet-mongodb's db test

Mike Smith 12 yıl önce
ebeveyn
işleme
a0320aa70d

+ 8 - 1
servlet/src/main/java/hello/PostgresServlet.java

@@ -88,7 +88,14 @@ public class PostgresServlet extends HttpServlet
     // Write JSON encoded message to the response.
     try
     {
-      Common.MAPPER.writeValue(res.getOutputStream(), worlds);
+      if (count == 1)
+      {
+        Common.MAPPER.writeValue(res.getOutputStream(), worlds[0]);
+      }
+      else
+      {
+        Common.MAPPER.writeValue(res.getOutputStream(), worlds);
+      }
     }
     catch (IOException ioe) 
     {