add tomcat embed

This commit is contained in:
Looly
2024-11-24 18:29:22 +08:00
parent 8bfce0e26e
commit 6ed0b11626
16 changed files with 652 additions and 24 deletions

View File

@@ -2,11 +2,10 @@ package org.dromara.hutool.http.server.engine;
import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.http.server.ServerConfig;
import org.dromara.hutool.http.server.engine.jetty.JettyEngine;
public class JettyTest {
public static void main(String[] args) {
final JettyEngine engine = new JettyEngine();
final ServerEngine engine = ServerEngineFactory.createEngine("jetty");
engine.init(ServerConfig.of());
engine.setHandler((request, response) -> {
Console.log(request.getPath());

View File

@@ -0,0 +1,16 @@
package org.dromara.hutool.http.server.engine;
import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.http.server.ServerConfig;
public class SunServerTest {
public static void main(String[] args) {
final ServerEngine engine = ServerEngineFactory.createEngine("SunHttpServer");
engine.init(ServerConfig.of());
engine.setHandler((request, response) -> {
Console.log(request.getPath());
response.write("Hutool Sun Server response test");
});
engine.start();
}
}

View File

@@ -0,0 +1,16 @@
package org.dromara.hutool.http.server.engine;
import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.http.server.ServerConfig;
public class TomcatTest {
public static void main(String[] args) {
final ServerEngine engine = ServerEngineFactory.createEngine("tomcat");
engine.init(ServerConfig.of());
engine.setHandler((request, response) -> {
Console.log(request.getPath());
response.write("Hutool Tomcat response test");
});
engine.start();
}
}

View File

@@ -18,11 +18,10 @@ package org.dromara.hutool.http.server.engine;
import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.http.server.ServerConfig;
import org.dromara.hutool.http.server.engine.undertow.UndertowEngine;
public class UndertowTest {
public static void main(String[] args) {
final UndertowEngine engine = new UndertowEngine();
final ServerEngine engine = ServerEngineFactory.createEngine("undertow");
engine.init(ServerConfig.of());
engine.setHandler((request, response) -> {
Console.log(request.getPath());