Class JettyHttpServerRegistry

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String initHttpServer(String schemeAndAuthority, boolean allowReuse) Creates an HTTP server at given URI.
      String registerContext(String schemeAndAuthority, boolean allowReuse, String contextPath, @Nullable() String mediaType, @Nullable() CommunicationLogContext communicationLogContext, HttpHandler handler) Registers a handler for HTTP requests destined to the given scheme, authority and context path.
      void unregisterContext(String schemeAndAuthority, String contextPath) Removes a handler for the given scheme, authority and context path.
      • Methods inherited from class com.google.common.util.concurrent.AbstractIdleService

        addListener, awaitRunning, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • initHttpServer

         String initHttpServer(String schemeAndAuthority, boolean allowReuse)

        Creates an HTTP server at given URI.

        If there was no running HTTP server found under the passed scheme and authority, this function starts a new one. If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.

        Parameters:
        schemeAndAuthority - the scheme and authority where to access the HTTP server.
        allowReuse - if the port given in schemeAndAuthority is 0, setting this to true will allow returning any already running server, while false will create a new server.
        Returns:

        the actual assigned URI of the HTTP server.

      • registerContext

         String registerContext(String schemeAndAuthority, boolean allowReuse, String contextPath, @Nullable() String mediaType, @Nullable() CommunicationLogContext communicationLogContext, HttpHandler handler)

        Registers a handler for HTTP requests destined to the given scheme, authority and context path.

        If the HTTP server supports both http and https schemes, the return value scheme will match the requested value.

        Parameters:
        schemeAndAuthority - scheme and authority used to start a new or re-use an existing HTTP server.
        allowReuse - if the port given in schemeAndAuthority is 0, settings this to true will allow returning any already running server, while false will create a new server.
        contextPath - the context path where the given registry shall listen to.
        mediaType - the media type of the response the handler will produce.
        communicationLogContext - additional information made available in the communication log of the registered context.
        handler - the handler callback that is invoked on a request to the given context path.
        Returns:

        the actual full path of the HTTP server address the given handler listens to.

      • unregisterContext

         void unregisterContext(String schemeAndAuthority, String contextPath)

        Removes a handler for the given scheme, authority and context path.

        handle will not be called for any request destined to the corresponding handler. Requests to the corresponding are answered with an HTTP 404.

        Parameters:
        schemeAndAuthority - scheme and authority where the context shall be removed.
        contextPath - the context path to remove.