Klasse HttpServiceServletContainerAdapter

java.lang.Object
org.jupnp.transport.impl.osgi.HttpServiceServletContainerAdapter
Alle implementierten Schnittstellen:
ServletContainerAdapter

public class HttpServiceServletContainerAdapter extends Object implements ServletContainerAdapter
This is a servlet container adapter for an OSGi http service. It is a singleton as there will be only a single OSGi http service available to register servlets on
Autor:
Kai Kreuzer, Ivan Iliev - No longer a singleton
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected org.osgi.service.http.HttpService
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    int
    addConnector(String host, int port)
    Might be called several times to set up the connectors.
    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
    Might be called several times to integrate the servlet container with jUPnP's executor configuration.
    void
    Start your servlet container if it isn't already running, might be called multiple times.
    void
    Stop your servlet container if it's still running, might be called multiple times.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • httpService

      protected org.osgi.service.http.HttpService httpService
  • Methodendetails

    • getInstance

      public static HttpServiceServletContainerAdapter getInstance(org.osgi.service.http.HttpService httpService, org.osgi.framework.BundleContext context)
    • setExecutorService

      public void setExecutorService(ExecutorService executorService)
      Beschreibung aus Schnittstelle kopiert: ServletContainerAdapter
      Might 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 jUPnP ExecutorService, make sure the Jetty container won't shut it down when ServletContainerAdapter.stopIfRunning() is called!
      Angegeben von:
      setExecutorService in Schnittstelle ServletContainerAdapter
      Parameter:
      executorService - The service to use when spawning new servlet execution threads.
    • addConnector

      public int addConnector(String host, int port) throws IOException
      Beschreibung aus Schnittstelle kopiert: ServletContainerAdapter
      Might 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:
      addConnector in Schnittstelle ServletContainerAdapter
      Parameter:
      host - The host address for the socket.
      port - The port, might be -1 to 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

      public void registerServlet(String contextPath, javax.servlet.Servlet servlet)
      Beschreibung aus Schnittstelle kopiert: ServletContainerAdapter
      Might be called several times to register (the same) handler for UPnP requests, should only register it once.
      Angegeben von:
      registerServlet in Schnittstelle ServletContainerAdapter
      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: ServletContainerAdapter
      Start your servlet container if it isn't already running, might be called multiple times.
      Angegeben von:
      startIfNotRunning in Schnittstelle ServletContainerAdapter
    • stopIfRunning

      public void stopIfRunning()
      Beschreibung aus Schnittstelle kopiert: ServletContainerAdapter
      Stop your servlet container if it's still running, might be called multiple times.
      Angegeben von:
      stopIfRunning in Schnittstelle ServletContainerAdapter