package com.eactive.eai.adapter.http.dynamic.wrapper;

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

public class KeepAliveFalseWrapper implements HandlerWrapper {
    @Override
    public HttpHandler wrap(HttpHandler handler) {
        return new HttpHandler() {
            @Override
            public void handleRequest(HttpServerExchange exchange) throws Exception {
                handler.handleRequest(exchange);
                exchange.getResponseHeaders().put(Headers.CONNECTION, "close");
            }
        };
    }
}

