Updated RESTAPIServlet to serve static javascript for asterix-core-api
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
index 29feb5e..04faba9 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
@@ -14,8 +14,7 @@
  */
 package edu.uci.ics.asterix.api.http.servlet;
 
-import java.io.IOException;
-import java.io.PrintWriter;
+import java.io.*;
 import java.util.List;
 
 import javax.servlet.ServletContext;
@@ -46,6 +45,25 @@
 
     private static final String HYRACKS_DATASET_ATTR = "edu.uci.ics.asterix.HYRACKS_DATASET";
 
+    private void serveAsStaticFile(String resourcePath, PrintWriter out, HttpServletResponse response) throws IOException {
+        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);
+        String line = br.readLine();
+
+        while (line != null) {
+            sb.append(line);
+            line = br.readLine();
+        }
+
+        out.println(sb.toString());
+    }
+
     @Override
     public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
         response.setContentType("application/json");
@@ -53,6 +71,12 @@
 
         PrintWriter out = response.getWriter();
 
+        String requestURI = request.getRequestURI();
+        if (requestURI.startsWith("/sdk/static/")) {
+            serveAsStaticFile(requestURI, out, response);
+            return;
+        }
+
         DisplayFormat format = DisplayFormat.HTML;
 
         String contentType = request.getContentType();