public class HttpServiceServletContainerAdapter extends Object implements ServletContainerAdapter
| Modifier and Type | Field and Description |
|---|---|
protected org.osgi.service.http.HttpService |
httpService |
| Modifier and Type | Method and Description |
|---|---|
int |
addConnector(String host,
int port)
Might be called several times to set up the connectors.
|
static HttpServiceServletContainerAdapter |
getInstance(org.osgi.service.http.HttpService httpService,
org.osgi.framework.BundleContext context) |
void |
registerServlet(String contextPath,
javax.servlet.Servlet servlet)
Might be called several times to register (the same) handler for UPnP
requests, should only register it once.
|
void |
setExecutorService(ExecutorService executorService)
Might be called several times to integrate the servlet container with jUPnP's executor
configuration.
|
void |
startIfNotRunning()
Start your servlet container if it isn't already running, might be called multiple times.
|
void |
stopIfRunning()
Stop your servlet container if it's still running, might be called multiple times.
|
public static HttpServiceServletContainerAdapter getInstance(org.osgi.service.http.HttpService httpService, org.osgi.framework.BundleContext context)
public void setExecutorService(ExecutorService executorService)
ServletContainerAdapterExecutorService,
make sure the Jetty container won't shut it down when ServletContainerAdapter.stopIfRunning() is called!setExecutorService in interface ServletContainerAdapterexecutorService - The service to use when spawning new servlet execution threads.public int addConnector(String host, int port) throws IOException
ServletContainerAdapteraddConnector in interface ServletContainerAdapterhost - The host address for the socket.port - The port, might be -1 to bind to an ephemeral port.IOException - If the connector couldn't be opened to retrieve the registered local port.public void registerServlet(String contextPath, javax.servlet.Servlet servlet)
ServletContainerAdapterregisterServlet in interface ServletContainerAdaptercontextPath - The context path prefix for all UPnP requests.servlet - The servlet handling all UPnP requests.public void startIfNotRunning()
ServletContainerAdapterstartIfNotRunning in interface ServletContainerAdapterpublic void stopIfRunning()
ServletContainerAdapterstopIfRunning in interface ServletContainerAdapterCopyright © 2023 jUPnP.org. All rights reserved.