Class Http4K
java.lang.Object
org.nustaq.kontraktor.remoting.http.undertow.Http4K
Created by ruedi on 25/05/15.
singleton to manage http server instances. Currently tied to Undertow however implicitely shields kontraktor-http
from getting too dependent on Undertow (which is an excellent piece of software, so no plans to migrate anytime soon)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BldFourKstatic BldFourKBuild(String hostName, int port, SSLContext ctx) builder(String hostName, int port, SSLContext ctx) protected io.undertow.Undertow.Buildercustomize(io.undertow.Undertow.Builder builder, io.undertow.server.handlers.PathHandler rootPathHandler, int port, String hostName, SSLContext context) static Http4Kget()org.nustaq.kontraktor.util.Pair<io.undertow.server.handlers.PathHandler,io.undertow.Undertow> creates or gets an undertow web server instance mapped by port.org.nustaq.kontraktor.util.Pair<io.undertow.server.handlers.PathHandler,io.undertow.Undertow> getServer(int port, String hostName, SSLContext context) org.nustaq.kontraktor.IPromise<org.nustaq.kontraktor.remoting.base.ActorServer>publish(HttpPublisher publisher) utility, just redirects to approriate connector.org.nustaq.kontraktor.IPromise<org.nustaq.kontraktor.remoting.base.ActorServer>publish(WebSocketPublisher publisher) utility, just redirects to approriate connector Publishes an actor/service via websockets protocol with given encoding.publishFileSystem(String hostName, String urlPath, int port, io.undertow.server.handlers.resource.FileResourceManager man) publishFileSystem(String hostName, String urlPath, int port, File root) publishes given file rootpublishHandler(String hostName, String urlPath, int port, io.undertow.server.HttpHandler handler) publishResourcePath(String hostName, String urlPath, int port, DynamicResourceManager man, boolean compress) publishResourcePath(String hostName, String urlPath, int port, DynamicResourceManager man, boolean compress, Function<io.undertow.server.HttpServerExchange, Boolean> interceptor) static voidunPublishHandler(String urlPath, int port)
-
Field Details
-
UNDERTOW_IO_THREADS
public static int UNDERTOW_IO_THREADS -
UNDERTOW_WORKER_THREADS
public static int UNDERTOW_WORKER_THREADS -
instance
-
serverMap
-
-
Constructor Details
-
Http4K
public Http4K()
-
-
Method Details
-
set
-
get
-
Build
-
Build
-
getServer
public org.nustaq.kontraktor.util.Pair<io.undertow.server.handlers.PathHandler,io.undertow.Undertow> getServer(int port, String hostName) creates or gets an undertow web server instance mapped by port. hostname must be given in case a new server instance has to be instantiated- Parameters:
port-hostName-- Returns:
-
getServer
public org.nustaq.kontraktor.util.Pair<io.undertow.server.handlers.PathHandler,io.undertow.Undertow> getServer(int port, String hostName, SSLContext context) -
builder
-
builder
-
customize
protected io.undertow.Undertow.Builder customize(io.undertow.Undertow.Builder builder, io.undertow.server.handlers.PathHandler rootPathHandler, int port, String hostName, SSLContext context) -
publishFileSystem
publishes given file root- Parameters:
hostName-urlPath- - prefixPath (e.g. /myapp/resource)port-root- - directory to be published
-
publishFileSystem
-
publishResourcePath
public Http4K publishResourcePath(String hostName, String urlPath, int port, DynamicResourceManager man, boolean compress) -
publishResourcePath
-
publish
public org.nustaq.kontraktor.IPromise<org.nustaq.kontraktor.remoting.base.ActorServer> publish(WebSocketPublisher publisher) utility, just redirects to approriate connector Publishes an actor/service via websockets protocol with given encoding. if this should be connectable from non-java code recommended coding is 'new Coding(SerializerType.JsonNoRefPretty)' (dev), 'new Coding(SerializerType.JsonNoRef)' (production) SerializerType.FSTSer is the most effective for java to java communication. -
publish
public org.nustaq.kontraktor.IPromise<org.nustaq.kontraktor.remoting.base.ActorServer> publish(HttpPublisher publisher) utility, just redirects to approriate connector. -
publishHandler
-
unPublishHandler
-