APIServerlet - png handling bug cont'd
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
index 589adab..f6f0ef9 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
@@ -113,7 +113,6 @@
     @Override
     public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
         String resourcePath = null;
-        PrintWriter out = response.getWriter();
         String requestURI = request.getRequestURI();
 
         if (requestURI.equals("/")) {
@@ -122,9 +121,14 @@
         } else {
             resourcePath = requestURI;
         }
-
+                
+        InputStream is = APIServlet.class.getResourceAsStream(resourcePath);
+        if (is == null) {
+            response.sendError(HttpServletResponse.SC_NOT_FOUND);
+            return;
+        }
+        
         if (resourcePath.endsWith(".png")) {
-            System.out.println("loading " + resourcePath + " as png");
             // Handle PNG content for webui
             response.setContentType(new MimetypesFileTypeMap().getContentType(resourcePath));
 
@@ -133,28 +137,20 @@
             response.setContentLength((int)pngFile.length());
 
             // Initialize filestreams, and write to output
-            FileInputStream pngIn = new FileInputStream(pngFile);
             OutputStream pngOut = response.getOutputStream();
 
             byte[] buf = new byte[1024];
             int len;
-            while ((len = pngIn.read(buf)) >= 0) {
-                System.out.println(new String(buf, 0, len));
+            while ((len = is.read(buf)) >= 0) {
                 pngOut.write(buf, 0, len);
             }
 
             // Close streams
             pngOut.close();
-            pngIn.close();
             return;
         }
-
+        
         response.setCharacterEncoding("utf-8");
-        InputStream is = APIServlet.class.getResourceAsStream(resourcePath);
-        if (is == null) {
-            response.sendError(HttpServletResponse.SC_NOT_FOUND);
-            return;
-        }
         InputStreamReader isr = new InputStreamReader(is);
         StringBuilder sb = new StringBuilder();
         BufferedReader br = new BufferedReader(isr);
@@ -165,6 +161,7 @@
             line = br.readLine();
         }
 
+        PrintWriter out = response.getWriter();
         out.println(sb.toString());
     }
 
diff --git a/asterix-app/src/main/resources/webui/querytemplate.html b/asterix-app/src/main/resources/webui/querytemplate.html
index 7b84213..503f845 100644
--- a/asterix-app/src/main/resources/webui/querytemplate.html
+++ b/asterix-app/src/main/resources/webui/querytemplate.html
@@ -52,7 +52,7 @@
         </a>
 
         <!-- Temporary logo placeholder -->
-        <a class="brand" href="#"><img src="static/img/finalasterixlogo.png"></a>
+        <a class="brand" href="#"><img src="/webui/static/img/finalasterixlogo.png"></a>
         <!--<a class="brand" href="#"><img src="http://db.tt/J1MTCdKs"></a>-->
         
         <div class="nav-collapse collapse">