Esempio n. 1
0
  private void getLog(HttpServletRequest request, HttpServletResponse response) {

    try {

      int id = Integer.parseInt(request.getParameter("id"));
      Log log = LogsDB.getLog(id);

      JSONObject obj = new JSONObject();
      obj.put("id", log.getId());
      obj.put("publicDNS", log.getPublicDNS());
      obj.put("pid", log.getPid());
      obj.put("logType", log.getLogType());
      obj.put("methodPath", log.getMethodPath());
      obj.put("lineNumber", log.getLineNumber());
      obj.put("added", log.getAdded());
      obj.put("data", log.getData());

      response.setContentType("application/json");
      response.setStatus(HttpServletResponse.SC_OK);
      response.getWriter().println(obj);

    } catch (Exception e) {
      new TalesException(new Throwable(), e);
    }
  }
Esempio n. 2
0
  private void errors(HttpServletResponse response) {

    try {

      // gets the errors
      JSONArray array = new JSONArray();

      for (Log log : LogsDB.getErrors(Globals.DASHBOARD_MAX_ERRORS)) {

        JSONObject obj = new JSONObject();
        obj.put("added", log.getAdded().toString());
        obj.put("id", log.getId());
        obj.put("publicDNS", log.getPublicDNS());
        obj.put("pid", log.getPid());
        obj.put("logType", log.getLogType());
        obj.put("methodPath", log.getMethodPath());
        obj.put("lineNumber", log.getLineNumber());

        array.add(obj);
      }

      // response
      response.setContentType("application/json");
      response.setStatus(HttpServletResponse.SC_OK);
      response.getWriter().println(array);

    } catch (Exception e) {
      new TalesException(new Throwable(), e);
    }
  }