public abstract class UpnpStream extends Object implements Runnable
Instantiated by the StreamServer
, executed by the
Router
. See the pseudo-code example
in the documentation of StreamServer
. An implementation's
run()
method has to call the process(org.fourthline.cling.model.message.StreamRequestMessage)
,
responseSent(org.fourthline.cling.model.message.StreamResponseMessage)
and
responseException(Throwable)
methods.
An implementation does not have to be thread-safe.
Modifier and Type | Field and Description |
---|---|
protected ProtocolFactory |
protocolFactory |
protected ReceivingSync |
syncProtocol |
Modifier | Constructor and Description |
---|---|
protected |
UpnpStream(ProtocolFactory protocolFactory) |
Modifier and Type | Method and Description |
---|---|
ProtocolFactory |
getProtocolFactory() |
StreamResponseMessage |
process(StreamRequestMessage requestMsg)
Selects a UPnP protocol, runs it within the calling thread, returns the response.
|
protected void |
responseException(Throwable t)
Must be called by a subclass if the response was not delivered to the client.
|
protected void |
responseSent(StreamResponseMessage responseMessage)
Must be called by a subclass after the response has been successfully sent to the client.
|
String |
toString() |
protected final ProtocolFactory protocolFactory
protected ReceivingSync syncProtocol
protected UpnpStream(ProtocolFactory protocolFactory)
public ProtocolFactory getProtocolFactory()
public StreamResponseMessage process(StreamRequestMessage requestMsg)
This method will return null
if the UPnP protocol returned null
.
The HTTP response in this case is always 404 NOT FOUND. Any other (HTTP) error
condition will be encapsulated in the returned response message and has to be
passed to the HTTP client as it is.
requestMsg
- The TCP (HTTP) stream request message.null
if a 404 should be send to the client.protected void responseSent(StreamResponseMessage responseMessage)
responseMessage
- The response message successfully sent to the client.protected void responseException(Throwable t)
t
- The reason why the response wasn't delivered.Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.