Пример #1
0
  /** Dumps the contents of the export table. */
  public void doDumpExportTable(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException, InterruptedException {
    // this is a debug probe and may expose sensitive information
    checkPermission(Jenkins.ADMINISTER);

    rsp.setContentType("text/plain");
    PrintWriter w = new PrintWriter(rsp.getCompressedWriter(req));
    VirtualChannel vc = getChannel();
    if (vc instanceof Channel) {
      w.println("Master to slave");
      ((Channel) vc).dumpExportTable(w);
      w.flush(); // flush here once so that even if the dump from the slave fails, the client
      // gets some useful info

      w.println("\n\n\nSlave to master");
      w.print(vc.call(new DumpExportTableTask()));
    } else {
      w.println(Messages.Computer_BadChannel());
    }
    w.close();
  }
 protected Writer createWriter(StaplerRequest req, StaplerResponse rsp, long size)
     throws IOException {
   // when sending big text, try compression. don't bother if it's small
   if (size > 4096) return rsp.getCompressedWriter(req);
   else return rsp.getWriter();
 }