code: protected void doRender(final String html, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
          PrintWriter writer;
          try {
              writer = response.getWriter();
          } catch (final Exception e) {
              writer = new PrintWriter(response.getOutputStream());
          }
  
          try {
              if (response.isCommitted()) { // response has been sent redirect
                  writer.flush();
                  writer.close();
  
                  return;
              }
  
              writer.write(html);
              writer.flush();
              writer.close();
          } catch (final Exception e) {
              LOGGER.log(Level.ERROR, "Writes pipe failed: " + e.getMessage());
          }
      }
docs: Processes the specified FreeMarker template with the specified request, data model and response.
  <p>
  Puts the page response contents into cache with the key getting from request attribute specified by <i>page cache
  key</i>.
  </p>
  
  @param html     the specified HTML content
  @param request  the specified request
  @param response the specified response
  @throws Exception exception