Package io.karatelabs.http
Class HttpServer
java.lang.Object
io.karatelabs.http.HttpServer
-
Method Summary
Modifier and TypeMethodDescriptionThe socket address the server actually bound to — a wildcard (isAnyLocalAddress) when started with a null/blank/"0.0.0.0"host, else the specific interface (e.g. loopback for"localhost").intgetPort()booleanisSsl()static voidstatic HttpServerstart(int port, io.netty.handler.ssl.SslContext sslContext, Function<HttpRequest, HttpResponse> handler) static HttpServerstart(int port, io.netty.handler.ssl.SslContext sslContext, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler) static HttpServerstart(int port, io.netty.handler.ssl.SslContext sslContext, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler, WsHandler wsHandler) static HttpServerstart(int port, Function<HttpRequest, HttpResponse> handler) static HttpServerstart(int port, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler) static HttpServerstart(int port, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler, WsHandler wsHandler) static HttpServerstart(String host, int port, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler, WsHandler wsHandler) Start bound to a specific interface —host="localhost"/"127.0.0.1"listens on loopback only (not reachable off-box),"0.0.0.0"/null/blank listens on every interface (the historical default).voidvoidvoidwaitSync()
-
Method Details
-
shutdownAll
public static void shutdownAll() -
start
-
start
public static HttpServer start(int port, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler) -
start
public static HttpServer start(int port, io.netty.handler.ssl.SslContext sslContext, Function<HttpRequest, HttpResponse> handler) -
start
public static HttpServer start(int port, io.netty.handler.ssl.SslContext sslContext, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler) -
start
public static HttpServer start(int port, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler, WsHandler wsHandler) -
start
public static HttpServer start(int port, io.netty.handler.ssl.SslContext sslContext, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler, WsHandler wsHandler) -
start
public static HttpServer start(String host, int port, Function<HttpRequest, HttpResponse> handler, SseHandler sseHandler, WsHandler wsHandler) Start bound to a specific interface —host="localhost"/"127.0.0.1"listens on loopback only (not reachable off-box),"0.0.0.0"/null/blank listens on every interface (the historical default). Lets a server be hardened to localhost-only; the caller (e.g. karate-maxserve) decides the default per deployment (host-dev = localhost, in-container = 0.0.0.0 so Docker-pforwarding can reach it). -
isSsl
public boolean isSsl() -
getPort
public int getPort() -
getLocalAddress
The socket address the server actually bound to — a wildcard (isAnyLocalAddress) when started with a null/blank/"0.0.0.0"host, else the specific interface (e.g. loopback for"localhost"). For diagnostics + tests of the bind-host hardening. -
waitSync
public void waitSync() -
stopAndWait
public void stopAndWait() -
stopAsync
public void stopAsync()
-