Created AsterixSDK servlet for serving the asterix-core API
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/AsterixSDKServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/AsterixSDKServlet.java
new file mode 100644
index 0000000..598090d
--- /dev/null
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/AsterixSDKServlet.java
@@ -0,0 +1,40 @@
+package edu.uci.ics.asterix.api.http.servlet;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+
+public class AsterixSDKServlet extends HttpServlet {
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ response.setContentType("application/json");
+ response.setCharacterEncoding("utf-8");
+
+ PrintWriter out = response.getWriter();
+ String requestURI = request.getRequestURI();
+
+ if (requestURI.startsWith("/sdk/static/")) {
+ InputStream is = APIServlet.class.getResourceAsStream(requestURI);
+ 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());
+
+ return;
+ }
+ }
+
+}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index 5ab94f3..b021aad 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -3,16 +3,11 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import edu.uci.ics.asterix.api.http.servlet.*;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
-import edu.uci.ics.asterix.api.http.servlet.APIServlet;
-import edu.uci.ics.asterix.api.http.servlet.DDLAPIServlet;
-import edu.uci.ics.asterix.api.http.servlet.QueryAPIServlet;
-import edu.uci.ics.asterix.api.http.servlet.QueryResultAPIServlet;
-import edu.uci.ics.asterix.api.http.servlet.QueryStatusAPIServlet;
-import edu.uci.ics.asterix.api.http.servlet.UpdateAPIServlet;
import edu.uci.ics.asterix.common.api.AsterixAppContextInfoImpl;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.metadata.MetadataManager;
@@ -116,5 +111,6 @@
context.addServlet(new ServletHolder(new QueryResultAPIServlet()), "/query/result");
context.addServlet(new ServletHolder(new UpdateAPIServlet()), "/update");
context.addServlet(new ServletHolder(new DDLAPIServlet()), "/ddl");
+ context.addServlet(new ServletHolder(new AsterixSDKServlet()), "/");
}
-}
\ No newline at end of file
+}