Class CustomHandlerServer
java.lang.Object
lv.id.jc.dicechess.runtime.CustomHandlerServer
A minimal HTTP server for the Azure Functions custom-handler model: one path, one
WebhookHandler, no framework.
Azure starts the custom-handler process and tells it which port to listen on via the
FUNCTIONS_CUSTOMHANDLER_PORT environment variable; startFromEnvironment(WebhookHandler)
reads it. Nothing here is Azure-specific beyond that one variable — the same server runs
identically under func start locally, or under any other host that can point HTTP
traffic at a port.
-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpServerstart(int port, String path, WebhookHandler handler) Starts the server on an explicit port and path.static HttpServerstartFromEnvironment(WebhookHandler handler) Starts the server on the port named byFUNCTIONS_CUSTOMHANDLER_PORT(default8080), servinghandlerat/api/webhook.
-
Method Details
-
startFromEnvironment
Starts the server on the port named byFUNCTIONS_CUSTOMHANDLER_PORT(default8080), servinghandlerat/api/webhook.- Parameters:
handler- the webhook logic to serve- Returns:
- the running server; call
HttpServer.stop(int)to shut it down - Throws:
IOException- if the port cannot be bound
-
start
Starts the server on an explicit port and path.- Parameters:
port- the port to listen onpath- the pathhandleranswers onhandler- the webhook logic to serve- Returns:
- the running server; call
HttpServer.stop(int)to shut it down - Throws:
IOException- if the port cannot be bound
-