Package org.openremote.container.web
Class WebService
java.lang.Object
org.openremote.container.web.WebService
- All Implemented Interfaces:
org.openremote.model.ContainerService
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected URI
protected static AtomicReference<CORSFilter>
protected boolean
protected String
protected List<WebService.RequestHandler>
static final String
static final String
static final boolean
static final String
static final int
static final String
static final String
static final String
static final int
static final String
protected int
protected io.undertow.Undertow
static final int
Fields inherited from interface org.openremote.model.ContainerService
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.protected io.undertow.Undertow.Builder
build
(org.openremote.model.Container container, io.undertow.Undertow.Builder builder) protected org.jboss.resteasy.spi.ResteasyDeployment
createResteasyDeployment
(org.openremote.model.Container container, Collection<Class<?>> apiClasses, Collection<Object> apiSingletons, boolean secure) getAllowedOrigins
(org.openremote.model.Container container) static io.undertow.servlet.api.FilterInfo
getCorsFilterInfo
(org.openremote.model.Container container) getExternalHostnames
(org.openremote.model.Container container) 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 HTTPprotected static String
int
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.When a request comes in the handlers are called in order until a handler returns a non null value; when this happens the returnedWebService.RequestHandler
is invoked.io.undertow.Undertow
void
init
(org.openremote.model.Container container) 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 ofContainerService.getPriority()
.static WebService.RequestHandler
pathStartsWithHandler
(String name, String path, io.undertow.server.HttpHandler handler) void
removeServletDeployment
(io.undertow.servlet.api.DeploymentInfo deploymentInfo) void
start
(org.openremote.model.Container container) 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 ofContainerService.getPriority()
.void
stop
(org.openremote.model.Container container) When the container is shutting down, it stops all services in the reverse order they were started.
-
Field Details
-
OR_WEBSERVER_LISTEN_HOST
- See Also:
-
OR_WEBSERVER_LISTEN_HOST_DEFAULT
- See Also:
-
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
- See Also:
-
OR_WEBSERVER_DUMP_REQUESTS_DEFAULT
public static final boolean OR_WEBSERVER_DUMP_REQUESTS_DEFAULT- See Also:
-
OR_WEBSERVER_ALLOWED_ORIGINS
- See Also:
-
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
- See Also:
-
WEBSERVER_WORKER_THREADS_MAX_DEFAULT
public static final int WEBSERVER_WORKER_THREADS_MAX_DEFAULT -
corsFilterRef
-
devMode
protected boolean devMode -
host
-
port
protected int port -
undertow
protected io.undertow.Undertow undertow -
httpHandlers
-
containerHostUri
-
-
Constructor Details
-
WebService
public WebService()
-
-
Method Details
-
getLocalIpAddress
- 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 interfaceorg.openremote.model.ContainerService
-
init
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 ofContainerService.getPriority()
.- Specified by:
init
in interfaceorg.openremote.model.ContainerService
- Throws:
Exception
-
start
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 ofContainerService.getPriority()
.- Specified by:
start
in interfaceorg.openremote.model.ContainerService
- Throws:
Exception
-
stop
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 interfaceorg.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
When a request comes in the handlers are called in order until a handler returns a non null value; when this happens the returnedWebService.RequestHandler
is invoked. -
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
-
getAllowedOrigins
-