java.lang.Object
org.nustaq.kontraktor.remoting.http.undertow.Http4K

public class Http4K
extends Object
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 Details

  • Constructor Details

  • Method Details

    • set

      public static void set​(Http4K http)
    • get

      public static Http4K get()
    • Build

      public static BldFourK Build​(String hostName, int port, SSLContext ctx)
    • Build

      public static BldFourK Build​(String hostName, int port)
    • 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

      public BldFourK builder​(String hostName, int port, SSLContext ctx)
    • builder

      public BldFourK builder​(String hostName, int port)
    • 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

      public Http4K publishFileSystem​(String hostName, String urlPath, int port, File root)
      publishes given file root
      Parameters:
      hostName -
      urlPath - - prefixPath (e.g. /myapp/resource)
      port -
      root - - directory to be published
    • publishFileSystem

      public Http4K publishFileSystem​(String hostName, String urlPath, int port, io.undertow.server.handlers.resource.FileResourceManager man)
    • publishResourcePath

      public Http4K publishResourcePath​(String hostName, String urlPath, int port, DynamicResourceManager man, boolean compress)
    • publishResourcePath

      public Http4K publishResourcePath​(String hostName, String urlPath, int port, DynamicResourceManager man, boolean compress, Function<io.undertow.server.HttpServerExchange,​Boolean> interceptor)
    • 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

      public Http4K publishHandler​(String hostName, String urlPath, int port, io.undertow.server.HttpHandler handler)
    • unPublishHandler

      public Http4K unPublishHandler​(String urlPath, int port)