mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add tomcat embed
This commit is contained in:
@@ -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());
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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());
|
||||
|
Reference in New Issue
Block a user