@Restricted(DoNotUse.class)
 public void doStatic(StaplerRequest req, StaplerResponse rsp) throws Exception {
   rsp.setContentType("text/html;charset=UTF-8");
   PrintWriter pw = rsp.getWriter();
   pw.println("<html><head><title>Jenkins Workflow Reference</title></head><body>");
   pw.println("<h1>Steps</h1>");
   for (StepDescriptor d : getStepDescriptors(false)) {
     generateStepHelp(d, pw);
   }
   pw.println("<h1>Advanced/Deprecated Steps</h1>");
   for (StepDescriptor d : getStepDescriptors(true)) {
     generateStepHelp(d, pw);
   }
   pw.println("<h1>Variables</h1>");
   for (GlobalVariable v : getGlobalVariables()) {
     pw.println("<h2><code>" + v.getName() + "</code></h2>");
     RequestDispatcher rd = req.getView(v, "help");
     if (rd != null) {
       pw.println("(help for variables not currently supported here)");
       /* TODO RequestDispatcher.include sends that content, but then closes the stream and prevents further output from appearing.
               Also ${rootURL} etc. are not set, but no idea what JellyContext to pass to Functions.initPageVariables
               Not clear how to fix these issues except by rewriting all of this to be driven from a static.jelly page.
               Also need to use new PrintWriter(new OutputStreamWriter(rsp.getOutputStream(), "UTF-8")) and pw.flush() at the end
               (cannot use getWriter since RequestDispatcher.include will call getOutputStream).
       rd.include(req, rsp);
       */
     } else {
       pw.println("(no help)");
     }
   }
   pw.println("</body></html>");
 }
Exemple #2
0
 @Override
 public void GlobalVariable(GlobalVariable variable) {
   encoder.encode(variable.getName());
 }