package com.stubbornjava.common.undertow;

import com.stubbornjava.common.Templating;

import io.undertow.server.HttpServerExchange;
import io.undertow.util.Headers;

public interface HtmlTemplateSender {

    default void sendRawHtmlTenplate(HttpServerExchange exchange, String rawTemplate, Object data) {
        exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/html");
        exchange.getResponseSender().send(Templating.instance().renderRawHtmlTemplate(rawTemplate, data));
    }

    default void sendHtmlTenplate(HttpServerExchange exchange, String templateName, Object data) {
        exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/html");
        exchange.getResponseSender().send(Templating.instance().renderHtmlTemplate(templateName, data));
    }
}

@@ -199,16 +199,40 @@
 nder %7B%0A%0A
+    // %7B%7Bstart:sender%7D%7D%0A
     defa
@@ -804,10 +804,32 @@
 ;%0A    %7D%0A
+    // %7B%7Bend:sender%7D%7D%0A
 %7D%0A

Annotate html sender