Package org.jupnp.transport.impl.jetty
Klasse JettyServletContainer
java.lang.Object
org.jupnp.transport.impl.jetty.JettyServletContainer
- Alle implementierten Schnittstellen:
ServletContainerAdapter
A singleton wrapper of a
org.eclipse.jetty.server.Server.
This ServletContainerAdapter starts a Jetty 9.4.x instance on its own and stops it.
Only one single context and servlet is registered, to handle UPnP requests.
This implementation might work on Android (not tested within JUPnP), dependencies are jetty-server
and jetty-servlet Maven modules.
- Autor:
- Christian Bauer - initial contribution, Victor Toni - refactoring for JUPnP
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final JettyServletContainerprotected org.eclipse.jetty.server.Server -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungintaddConnector(String host, int port) Might be called several times to set up the connectors.voidregisterServlet(String contextPath, javax.servlet.Servlet servlet) Might be called several times to register (the same) handler for UPnP requests, should only register it once.protected voidvoidsetExecutorService(ExecutorService executorService) Might be called several times to integrate the servlet container with jUPnP's executor configuration.voidStart your servlet container if it isn't already running, might be called multiple times.voidStop your servlet container if it's still running, might be called multiple times.
-
Felddetails
-
INSTANCE
-
server
protected org.eclipse.jetty.server.Server server
-
-
Methodendetails
-
setExecutorService
Beschreibung aus Schnittstelle kopiert:ServletContainerAdapterMight be called several times to integrate the servlet container with jUPnP's executor configuration. You can ignore this call if you want to configure the container's thread pooling independently from jUPnP. If you use the given jUPnPExecutorService, make sure the Jetty container won't shut it down whenServletContainerAdapter.stopIfRunning()is called!- Angegeben von:
setExecutorServicein SchnittstelleServletContainerAdapter- Parameter:
executorService- The service to use when spawning new servlet execution threads.
-
addConnector
Beschreibung aus Schnittstelle kopiert:ServletContainerAdapterMight be called several times to set up the connectors. This is the host/address and the port jUPnP expects to receive HTTP requests on. If you set up your HTTP server connectors elsewhere and ignore when jUPnP calls this method, make sure you configure jUPnP with the correct host/port of your servlet container.- Angegeben von:
addConnectorin SchnittstelleServletContainerAdapter- Parameter:
host- The host address for the socket.port- The port, might be-1to bind to an ephemeral port.- Gibt zurück:
- The actual registered local port.
- Löst aus:
IOException- If the connector couldn't be opened to retrieve the registered local port.
-
registerServlet
Beschreibung aus Schnittstelle kopiert:ServletContainerAdapterMight be called several times to register (the same) handler for UPnP requests, should only register it once.- Angegeben von:
registerServletin SchnittstelleServletContainerAdapter- Parameter:
contextPath- The context path prefix for all UPnP requests.servlet- The servlet handling all UPnP requests.
-
startIfNotRunning
public void startIfNotRunning()Beschreibung aus Schnittstelle kopiert:ServletContainerAdapterStart your servlet container if it isn't already running, might be called multiple times.- Angegeben von:
startIfNotRunningin SchnittstelleServletContainerAdapter
-
stopIfRunning
public void stopIfRunning()Beschreibung aus Schnittstelle kopiert:ServletContainerAdapterStop your servlet container if it's still running, might be called multiple times.- Angegeben von:
stopIfRunningin SchnittstelleServletContainerAdapter
-
resetServer
protected void resetServer()
-