code: public final void doCaptcha(StaplerRequest req, StaplerResponse rsp) throws IOException {
          if (captchaSupport != null) {
              String id = req.getSession().getId();
              rsp.setContentType("image/png");
              // source: https://stackoverflow.com/a/3414217
              rsp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
              rsp.setHeader("Pragma", "no-cache");
              rsp.setHeader("Expires", "0");
              captchaSupport.generateImage(id, rsp.getOutputStream());
          }
      }
docs: Generates a captcha image.