Пример #1
0
  public PasswordRecovery() {

    try {
      api = new Api();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("json");
    int id = Integer.parseInt(request.getParameter("id"));

    DTOCliente cliente = new DTOCliente();
    PrintWriter out = response.getWriter();
    try {
      out.print(cliente.getCliente(id));
    } catch (JSONException e) {
      e.printStackTrace();
    }
    out.close();
  }
Пример #3
0
 private void updateJsonWithReport() {
   try {
     json.getCloudCoverData()
         .put(
             new JSONArray()
                 .put(currentReport.getCurrentTimeslot().getStartInstant().getMillis())
                 .put(currentReport.getCloudCover()));
     json.getTemperatureData()
         .put(
             new JSONArray()
                 .put(currentReport.getCurrentTimeslot().getStartInstant().getMillis())
                 .put(currentReport.getTemperature()));
     json.getWindSpeedData()
         .put(
             new JSONArray()
                 .put(currentReport.getCurrentTimeslot().getStartInstant().getMillis())
                 .put(currentReport.getWindSpeed()));
   } catch (JSONException e) {
     e.printStackTrace();
   }
 }