public class StreamServerImpl extends Object implements StreamServer<StreamServerConfigurationImpl>
See the documentation of the SUN JDK 6.0 HTTP Server.
This implementation DOES NOT WORK on Android. Read the Cling manual for alternatives for Android.
This implementation does not support connection alive checking, as we can't send heartbeats to the client. We don't have access to the raw socket with the Sun API.
Modifier and Type | Class and Description |
---|---|
protected class |
StreamServerImpl.HttpServerConnection |
protected class |
StreamServerImpl.RequestHttpHandler |
Modifier and Type | Field and Description |
---|---|
protected StreamServerConfigurationImpl |
configuration |
protected com.sun.net.httpserver.HttpServer |
server |
Constructor and Description |
---|
StreamServerImpl(StreamServerConfigurationImpl configuration) |
Modifier and Type | Method and Description |
---|---|
StreamServerConfigurationImpl |
getConfiguration() |
int |
getPort()
This method will be called potentially right after
StreamServer.init(java.net.InetAddress, org.fourthline.cling.transport.Router) , the
actual assigned local port must be available before the server is started. |
void |
init(InetAddress bindAddress,
Router router)
Configures the service and starts any listening sockets.
|
protected boolean |
isConnectionOpen(com.sun.net.httpserver.HttpExchange exchange)
Logs a warning and returns
true , we can't access the socket using the awful JDK webserver API. |
void |
run() |
void |
stop()
Stops the service, closes any listening sockets.
|
protected final StreamServerConfigurationImpl configuration
protected com.sun.net.httpserver.HttpServer server
public StreamServerImpl(StreamServerConfigurationImpl configuration)
public void init(InetAddress bindAddress, Router router) throws InitializationException
StreamServer
init
in interface StreamServer<StreamServerConfigurationImpl>
bindAddress
- The address to bind any sockets on.router
- The router which handles the incoming UpnpStream
.InitializationException
- If the service could not be initialized or started.public int getPort()
StreamServer
StreamServer.init(java.net.InetAddress, org.fourthline.cling.transport.Router)
, the
actual assigned local port must be available before the server is started.getPort
in interface StreamServer<StreamServerConfigurationImpl>
public StreamServerConfigurationImpl getConfiguration()
getConfiguration
in interface StreamServer<StreamServerConfigurationImpl>
public void stop()
StreamServer
stop
in interface StreamServer<StreamServerConfigurationImpl>
protected boolean isConnectionOpen(com.sun.net.httpserver.HttpExchange exchange)
true
, we can't access the socket using the awful JDK webserver API.
Override this method if you know how to do it.
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.