code: @SuppressWarnings("squid:S3752") // backwards compatability: multiple methods required
    @RequestMapping(
        method = {RequestMethod.GET, RequestMethod.POST},
        value = "/scripts/{name}/run")
    public void runScript(
        @PathVariable("name") String scriptName,
        @RequestParam Map<String, Object> parameters,
        HttpServletResponse response)
        throws IOException {
      ScriptResult result = savedScriptRunner.runScript(scriptName, parameters);
  
      if (result.getOutputFile() != null) {
        response.sendRedirect(format("/files/{0}", result.getOutputFile().getId()));
      } else if (StringUtils.isNotBlank(result.getOutput())) {
        response.setContentType("text/plain");
  
        PrintWriter pw = response.getWriter();
        pw.write(result.getOutput());
        pw.flush();
      }
    }
docs: Runs a Script, waits for it to finish and returns the result.
  
  <p>If the result has an outputFile, will redirect to a URL where you can download the result
  file. Otherwise, if the result has output, will write the script output to the response and
  serve it as /text/plain.
  
  @param scriptName name of the Script to run
  @param parameters parameter values for the script
  @param response {@link HttpServletResponse} to return the result
  @throws IOException if something goes wrong when redirecting or writing the result
  @throws ScriptException if the script name is unknown or one of the script parameters is
  missing