<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ page import="org.json.simple.JSONObject" %> <%@ page import="org.json.simple.JSONValue" %> <%@ page import="edu.uic.evl.hands.N3VizDataJSONFileCollector" %> <%@ page import="edu.uic.evl.hands.N3VizDataCollectorInterface" %> <% JSONObject replyObj; try { System.out.println("-> Preparing N3 viz data based on request interval."); if (request != null) { String strJSON = request.getParameter("strJSON"); if (strJSON != null) { JSONObject objJSON = (JSONObject) JSONValue.parseWithException(strJSON); if (objJSON != null) { Object msg = objJSON.get("interval"); N3VizDataCollectorInterface collector = new N3VizDataJSONFileCollector(); if (msg != null) { String intervalRange = msg.toString(); System.out.println("-> Requested interval: '" + intervalRange + "'"); collector.setSourceKey(intervalRange); replyObj = collector.goCollect(); if(replyObj == null) { replyObj = new JSONObject(); replyObj.put("source", "nullFromCollector"); } out.write(replyObj.toJSONString()); } } } } } catch (Exception e) { // Default empty reply replyObj = new JSONObject(); replyObj.put("source", N3VizDataJSONFileCollector.DEFAULT_SOURCE_KEY); out.write(replyObj.toJSONString()); e.printStackTrace(); } %>