code: protected boolean sendProcessedTemplate(
              Request.In event, IOSubchannel channel, Template tpl) {
          // Prepare response
          HttpResponse response = event.httpRequest().response().get();
          MediaType mediaType = contentType(
              ResponseCreationSupport.uriFromPath(tpl.getSourceName()));
          response.setContentType(mediaType);
  
          // Send response
          response.setStatus(HttpStatus.OK);
          response.setField(HttpField.LAST_MODIFIED, Instant.now());
          if (maxAgeCalculator == null) {
              ResponseCreationSupport.setMaxAge(response, 0);
          } else {
              ResponseCreationSupport.setMaxAge(response,
                  maxAgeCalculator.maxAge(event.httpRequest(), mediaType));
          }
          channel.respond(new Response(response));
  
          // Send content
          try (ByteBufferOutputStream bbos = new ByteBufferOutputStream(
              channel, channel.responsePipeline());
                  Writer out = new OutputStreamWriter(
                      bbos.suppressClose(), "utf-8")) {
              Map<String, Object> model = fmSessionModel(
                  event.associated(Session.class));
              tpl.setLocale((Locale) model.get("locale"));
              tpl.process(model, out);
              return true;
          } catch (IOException | TemplateException e) {
              // Too late to do anything about this (header was sent).
              fire(new Error(event, e), channel);
          }
          return false;
      }
docs: Render a response using the given template. Send the
  {@link Response} and at least one {@link Output} event.
  
  If the method does not return `true`, the invoker should close
  the connection because it is most likely in an undefined state.
  
  @param event the request event
  @param channel the channel
  @param tpl the template
  @return false if an error occurred