Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.teleal.cling.transport.spi
Class UpnpStream

    java.lang.Object
      org.teleal.cling.transport.spi.UpnpStream

All Implemented Interfaces:
  Runnable

Direct Known Subclasses:
  HttpExchangeUpnpStream, HttpServerConnectionUpnpStream

    public abstract class UpnpStream

extends Object
implements Runnable

A runnable representation of a single HTTP request/response procedure.

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.teleal.cling.model.message.StreamRequestMessage)`, `responseSent(org.teleal.cling.model.message.StreamResponseMessage)` and `responseException(Throwable)` methods.

An implementation does not have to be thread-safe.

Author:
  Christian Bauer

Field Summary
`protected ProtocolFactory` | `protocolFactory`
`protected ReceivingSync` | `syncProtocol`

Constructor Summary
`protected` | `UpnpStream(ProtocolFactory protocolFactory)`

Method Summary
`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()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.lang.Runnable
`run`

Field Detail

### protocolFactory

    protected final ProtocolFactory protocolFactory

### syncProtocol

    protected ReceivingSync syncProtocol

Constructor Detail

### UpnpStream

    protected UpnpStream(ProtocolFactory protocolFactory)

Method Detail

### getProtocolFactory

    public ProtocolFactory getProtocolFactory()

### process

    public StreamResponseMessage process(StreamRequestMessage requestMsg)

  Selects a UPnP protocol, runs it within the calling thread, returns the response.

  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.

  Parameters:
    `requestMsg` - The TCP (HTTP) stream request message.
  Returns:
    The TCP (HTTP) stream response message, or `null` if a 404 should be send to the client.

### responseSent

    protected void responseSent(StreamResponseMessage responseMessage)

  Must be called by a subclass after the response has been successfully sent to the client.

  Parameters:
    `responseMessage` - The response message successfully sent to the client.

### responseException

    protected void responseException(Throwable t)

  Must be called by a subclass if the response was not delivered to the client.

  Parameters:
    `t` - The reason why the response wasn't delivered.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Teleal GmbH, Switzerland. All Rights Reserved.