|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fourthline.cling.transport.impl.jetty.JettyServletContainer
public class JettyServletContainer
A singleton wrapper of a org.eclipse.jetty.server.Server
.
This ServletContainerAdapter
starts
a Jetty 8 instance on its own and stops it. Only one single context and servlet
is registered, to handle UPnP requests.
This implementation works on Android, dependencies are jetty-server
and jetty-servlet
Maven modules.
Field Summary | |
---|---|
static JettyServletContainer |
INSTANCE
|
protected org.eclipse.jetty.server.Server |
server
|
Method Summary | |
---|---|
int |
addConnector(String host,
int port)
Might be called several times to set up the connectors. |
void |
registerServlet(String contextPath,
javax.servlet.Servlet servlet)
Might be called several times register (the same) handler for UPnP requests, should only register it once. |
protected void |
resetServer()
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final JettyServletContainer INSTANCE
protected org.eclipse.jetty.server.Server server
Method Detail |
---|
public int addConnector(String host, int port) throws IOException
ServletContainerAdapter
addConnector
in interface ServletContainerAdapter
host
- 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)
ServletContainerAdapter
registerServlet
in interface ServletContainerAdapter
contextPath
- The context path prefix for all UPnP requests.servlet
- The servlet handling all UPnP requests.public void startIfNotRunning()
ServletContainerAdapter
startIfNotRunning
in interface ServletContainerAdapter
public void stopIfRunning()
ServletContainerAdapter
stopIfRunning
in interface ServletContainerAdapter
protected void resetServer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |