code: public static void respondAsHtmlUsingArgsAndTemplateWithHttpStatus(HttpServletResponse resp,
              String resourcePageTemplate, int statusCode, Object... args) throws IOException {
          resp.setContentType("text/html");
          resp.setCharacterEncoding("UTF-8");
          resp.setStatus(statusCode);
  
          String template = IOUtils.toString(ServletHelper.class.getResourceAsStream(resourcePageTemplate), "UTF-8");
          template = String.format(template, args);
          resp.getOutputStream().print(template);
          resp.flushBuffer();
      }
docs: Sends a HTTP response as a text/html document and with a HTTP status code. Injects the the provided arguments
  into the template before responding.
  
  @param resp
  A {@link HttpServletResponse} object that the servlet is responding on.
  @param resourcePageTemplate
  The HTML template to use which is loaded as a classpath resource.
  @param statusCode
  The HTTP status code to send with the response.
  @param args
  Data which will be inserted in to the template. Data must be typed in accordance with template
  expectations -- all args are passed to <code>String.format</code>
  @throws IOException