Class WebService

java.lang.Object
org.openremote.container.web.WebService
All Implemented Interfaces:
org.openremote.model.ContainerService

public abstract class WebService extends Object implements org.openremote.model.ContainerService
  • Field Details

    • OR_WEBSERVER_LISTEN_HOST

      public static final String OR_WEBSERVER_LISTEN_HOST
      See Also:
    • OR_WEBSERVER_LISTEN_HOST_DEFAULT

      public static final String OR_WEBSERVER_LISTEN_HOST_DEFAULT
      See Also:
    • OR_WEBSERVER_LISTEN_PORT

      public static final String OR_WEBSERVER_LISTEN_PORT
      See Also:
    • OR_WEBSERVER_LISTEN_PORT_DEFAULT

      public static final int OR_WEBSERVER_LISTEN_PORT_DEFAULT
      See Also:
    • OR_WEBSERVER_DUMP_REQUESTS

      public static final String OR_WEBSERVER_DUMP_REQUESTS
      See Also:
    • OR_WEBSERVER_DUMP_REQUESTS_DEFAULT

      public static final boolean OR_WEBSERVER_DUMP_REQUESTS_DEFAULT
      See Also:
    • OR_WEBSERVER_ALLOWED_ORIGINS

      public static final String OR_WEBSERVER_ALLOWED_ORIGINS
      See Also:
    • OR_WEBSERVER_IO_THREADS_MAX

      public static final String OR_WEBSERVER_IO_THREADS_MAX
      See Also:
    • OR_WEBSERVER_IO_THREADS_MAX_DEFAULT

      public static final int OR_WEBSERVER_IO_THREADS_MAX_DEFAULT
    • OR_WEBSERVER_WORKER_THREADS_MAX

      public static final String OR_WEBSERVER_WORKER_THREADS_MAX
      See Also:
    • WEBSERVER_WORKER_THREADS_MAX_DEFAULT

      public static final int WEBSERVER_WORKER_THREADS_MAX_DEFAULT
    • corsFilterRef

      protected static AtomicReference<CORSFilter> corsFilterRef
    • devMode

      protected boolean devMode
    • host

      protected String host
    • port

      protected int port
    • undertow

      protected io.undertow.Undertow undertow
    • httpHandlers

      protected List<WebService.RequestHandler> httpHandlers
    • containerHostUri

      protected URI containerHostUri
  • Constructor Details

    • WebService

      public WebService()
  • Method Details

    • getLocalIpAddress

      protected static String getLocalIpAddress() throws Exception
      Throws:
      Exception
    • pathStartsWithHandler

      public static WebService.RequestHandler pathStartsWithHandler(String name, String path, io.undertow.server.HttpHandler handler)
    • getPriority

      public int getPriority()
      Description copied from interface: org.openremote.model.ContainerService
      Gets the priority of this service which is used to determine initialization order when services are auto discovered; services with a lower priority are initialized and started first.
      Specified by:
      getPriority in interface org.openremote.model.ContainerService
    • init

      public void init(org.openremote.model.Container container) throws Exception
      Description copied from interface: org.openremote.model.ContainerService
      All services are initialized in the order they have been added to the container (if container started with explicit list of services) otherwise they are initialized in order of ContainerService.getPriority().
      Specified by:
      init in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • start

      public void start(org.openremote.model.Container container) throws Exception
      Description copied from interface: org.openremote.model.ContainerService
      After initialization, services are started in the order they have been added to the container (if container started with explicit list of services) otherwise they are started in order of ContainerService.getPriority().
      Specified by:
      start in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • stop

      public void stop(org.openremote.model.Container container) throws Exception
      Description copied from interface: org.openremote.model.ContainerService
      When the container is shutting down, it stops all services in the reverse order they were started.
      Specified by:
      stop in interface org.openremote.model.ContainerService
      Throws:
      Exception
    • addServletDeployment

      public static io.undertow.server.HttpHandler addServletDeployment(org.openremote.model.Container container, io.undertow.servlet.api.DeploymentInfo deploymentInfo, boolean secure)
      Adds a deployment to the default servlet container and returns the started handler.
    • removeServletDeployment

      public void removeServletDeployment(io.undertow.servlet.api.DeploymentInfo deploymentInfo)
    • getRequestHandlers

      public List<WebService.RequestHandler> getRequestHandlers()
      When a request comes in the handlers are called in order until a handler returns a non null value; when this happens the returned WebService.RequestHandler is invoked.
    • getHostUri

      public URI getHostUri()
      Provides the LAN IPv4 address the container is bound to so it can be used in the context provider callbacks; if CB is on the other side of some sort of NAT then this won't work also assumes HTTP
    • build

      protected io.undertow.Undertow.Builder build(org.openremote.model.Container container, io.undertow.Undertow.Builder builder)
    • createResteasyDeployment

      protected org.jboss.resteasy.spi.ResteasyDeployment createResteasyDeployment(org.openremote.model.Container container, Collection<Class<?>> apiClasses, Collection<Object> apiSingletons, boolean secure)
    • getUndertow

      public io.undertow.Undertow getUndertow()
    • getCorsFilterInfo

      public static io.undertow.servlet.api.FilterInfo getCorsFilterInfo(org.openremote.model.Container container)
    • getExternalHostnames

      public static List<String> getExternalHostnames(org.openremote.model.Container container)
    • getAllowedOrigins

      public static Set<String> getAllowedOrigins(org.openremote.model.Container container)