Beispiel #1
0
  private int writeCSV(PrintWriter out, int level, ReportData rd, boolean mimeCSV)
      throws ReportException {

    /* MIME type */
    // (See "org.opengts.war.track.page.ReportDisplay:writePage")
    HttpServletResponse response = rd.getRequestProperties().getHttpServletResponse();
    if (mimeCSV) {
      CommonServlet.setResponseContentType(response, HTMLTools.MIME_CSV());
    } else {
      CommonServlet.setResponseContentType(response, HTMLTools.MIME_PLAIN());
    }

    /* header row */
    this.rptHeader.writeCSV(out, level + 1, rd);

    /* body */
    this.rptBody.writeCSV(out, level + 1, rd);
    return this.rptBody.getRecordCount();
  }
Beispiel #2
0
 private Document GetXMLDocument(String url) {
   try {
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     DocumentBuilder db = dbf.newDocumentBuilder();
     InputStream input = HTMLTools.inputStream_GET(url, 5000);
     InputStreamReader reader = new InputStreamReader(input, ENCODING_UTF8);
     InputSource inSrc = new InputSource(reader);
     inSrc.setEncoding(ENCODING_UTF8);
     return db.parse(inSrc);
   } catch (ParserConfigurationException pce) {
     Print.logError("Parse error: " + pce);
     return null;
   } catch (SAXException se) {
     Print.logError("Parse error: " + se);
     return null;
   } catch (IOException ioe) {
     Print.logError("IO error: " + ioe);
     return null;
   }
 }