コード例 #1
0
 /** Transformation of html code which modify all formular's items to read-only */
 public void transformToReadOnly(StaplerRequest request, StaplerResponse response)
     throws IOException {
   try {
     DefaultScriptInvoker invoker = new DefaultScriptInvoker();
     ByteArrayOutputStream out = new ByteArrayOutputStream();
     HTMLWriterOutput xmlOutput = HTMLWriterOutput.create(out);
     Script script = compileScript();
     xmlOutput.useHTML(true);
     invoker.invokeScript(request, response, script, project, xmlOutput);
     String page = ReadOnlyUtil.transformInputsToReadOnly(out.toString("UTF-8"), null);
     OutputStream output = response.getCompressedOutputStream(request);
     output.write(page.getBytes());
     output.close();
   } catch (Exception ex) {
     ex.printStackTrace(new PrintStream(response.getOutputStream()));
   }
 }
コード例 #2
0
 public boolean isAvailable() throws IOException, ServletException {
   return ReadOnlyUtil.isAvailableJobConfiguration(project);
 }