package com.networknt.demo;

import io.undertow.Handlers;
import io.undertow.Undertow;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.RoutingHandler;
import io.undertow.servlet.api.DeploymentInfo;
import io.undertow.util.Headers;
import io.undertow.util.Methods;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.undertow.UndertowBuilderCustomizer;
import org.springframework.boot.web.embedded.undertow.UndertowDeploymentInfoCustomizer;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.context.annotation.Bean;

import java.util.Collections;

@SpringBootApplication
public class DemoApplication {

	@Bean
	UndertowServletWebServerFactory embeddedServletWebFactory() {
		UndertowServletWebServerFactory factory = new UndertowServletWebServerFactory();
		factory.addDeploymentInfoCustomizers(new UndertowDeploymentInfoCustomizer() {
			@Override
			public void customize(DeploymentInfo deploymentInfo) {
				deploymentInfo.addInitialHandlerChainWrapper(handler -> {
							return Handlers.path()
									.addPrefixPath("/", handler)
									.addPrefixPath("/light-4j", getTestHandler());
						}
				);
			}
		});

		return factory;
	}

	static HttpHandler getTestHandler() {
		return new HttpHandler() {
			@Override
			public void handleRequest(HttpServerExchange httpServerExchange) throws Exception {
				httpServerExchange.getResponseSender().send("OK");
			}
		};
	}

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}

}

@@ -55,37 +55,8 @@
 rs;%0A
-import io.undertow.Undertow;%0A
 impo
@@ -82,32 +82,32 @@
 er.HttpHandler;%0A
+
 import io.undert
@@ -140,50 +140,8 @@
 ge;%0A
-import io.undertow.server.RoutingHandler;%0A
 impo
@@ -187,74 +187,8 @@
 fo;%0A
-import io.undertow.util.Headers;%0Aimport io.undertow.util.Methods;%0A
 impo
@@ -307,89 +307,8 @@
 on;%0A
-import org.springframework.boot.web.embedded.undertow.UndertowBuilderCustomizer;%0A
 impo
@@ -478,16 +478,16 @@
 actory;%0A
+
 import o
@@ -535,39 +535,8 @@
 n;%0A%0A
-import java.util.Collections;%0A%0A
 @Spr

update spring boot performance example imports