public void serializeHistoryCursor(
      Collection<TrackHistory> historyCursor, HttpServletResponse httpServletResponse) {
    try {
      final ServletOutputStream httpOutputStream = httpServletResponse.getOutputStream();
      final BufferedWriter outputStream =
          new BufferedWriter(new OutputStreamWriter(httpOutputStream));
      outputStream.write("{");
      outputStream.write("\"count\":");
      outputStream.write("" + historyCursor.size());

      if (historyCursor.size() > 0) {
        Gson gson = new Gson();

        outputStream.write(",");
        outputStream.write("\"tracks\":[");

        for (Iterator<TrackHistory> iterator = historyCursor.iterator(); iterator.hasNext(); ) {
          TrackHistory next = iterator.next();
          outputStream.write(gson.toJson(toWebTrack(next)));
          if (iterator.hasNext()) {
            outputStream.write(",");
          }
          outputStream.flush();
        }

        /*
                        while (historyCursor.hasNext())
                        {
                            outputStream.write(gson.toJson(toWebTrack(historyCursor.next())));
                            if (historyCursor.hasNext())
                            {
                                outputStream.write(",");
                            }
                            outputStream.flush();
                        }
        */
        outputStream.write("]");
      }
      outputStream.write("}");
      outputStream.flush();
      outputStream.close();
      httpOutputStream.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  private void setPollerConfiguration(PollerConfiguration pollconfig) {
    try {
      pollconfig.validate();

      BufferedWriter bw =
          new BufferedWriter(
              new FileWriter(
                  WTProperties.getValue("SNMPConfig.directory") + "poller-configuration.xml"));
      pollconfig.marshal(bw);
      bw.flush();
      bw.close();
    } catch (MarshalException me) {
      me.printStackTrace();
    } catch (ValidationException ve) {
      ve.printStackTrace();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }