org.fourthline.cling.transport.impl
Class AsyncServletUpnpStream

java.lang.Object
  extended by org.fourthline.cling.transport.spi.UpnpStream
      extended by org.fourthline.cling.transport.impl.AsyncServletUpnpStream
All Implemented Interfaces:
Runnable, EventListener, javax.servlet.AsyncListener

public abstract class AsyncServletUpnpStream
extends UpnpStream
implements javax.servlet.AsyncListener

Implementation based on Servlet 3.0 API.

Concrete implementations must provide a connection wrapper, as this wrapper most likely has to access proprietary APIs to implement connection checking.

Author:
Christian Bauer

Field Summary
protected  javax.servlet.AsyncContext asyncContext
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  StreamResponseMessage responseMessage
           
 
Fields inherited from class org.fourthline.cling.transport.spi.UpnpStream
protocolFactory, syncProtocol
 
Constructor Summary
AsyncServletUpnpStream(ProtocolFactory protocolFactory, javax.servlet.AsyncContext asyncContext, javax.servlet.http.HttpServletRequest request)
           
 
Method Summary
protected  void complete()
           
protected abstract  Connection createConnection()
           
protected  javax.servlet.http.HttpServletRequest getRequest()
           
protected  javax.servlet.http.HttpServletResponse getResponse()
           
 void onComplete(javax.servlet.AsyncEvent event)
           
 void onError(javax.servlet.AsyncEvent event)
           
 void onStartAsync(javax.servlet.AsyncEvent event)
           
 void onTimeout(javax.servlet.AsyncEvent event)
           
protected  StreamRequestMessage readRequestMessage()
           
 void run()
           
protected  void writeResponseMessage(StreamResponseMessage responseMessage)
           
 
Methods inherited from class org.fourthline.cling.transport.spi.UpnpStream
getProtocolFactory, process, responseException, responseSent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

asyncContext

protected final javax.servlet.AsyncContext asyncContext

request

protected final javax.servlet.http.HttpServletRequest request

responseMessage

protected StreamResponseMessage responseMessage
Constructor Detail

AsyncServletUpnpStream

public AsyncServletUpnpStream(ProtocolFactory protocolFactory,
                              javax.servlet.AsyncContext asyncContext,
                              javax.servlet.http.HttpServletRequest request)
Method Detail

getRequest

protected javax.servlet.http.HttpServletRequest getRequest()

getResponse

protected javax.servlet.http.HttpServletResponse getResponse()

complete

protected void complete()

run

public void run()
Specified by:
run in interface Runnable

onStartAsync

public void onStartAsync(javax.servlet.AsyncEvent event)
                  throws IOException
Specified by:
onStartAsync in interface javax.servlet.AsyncListener
Throws:
IOException

onComplete

public void onComplete(javax.servlet.AsyncEvent event)
                throws IOException
Specified by:
onComplete in interface javax.servlet.AsyncListener
Throws:
IOException

onTimeout

public void onTimeout(javax.servlet.AsyncEvent event)
               throws IOException
Specified by:
onTimeout in interface javax.servlet.AsyncListener
Throws:
IOException

onError

public void onError(javax.servlet.AsyncEvent event)
             throws IOException
Specified by:
onError in interface javax.servlet.AsyncListener
Throws:
IOException

readRequestMessage

protected StreamRequestMessage readRequestMessage()
                                           throws IOException
Throws:
IOException

writeResponseMessage

protected void writeResponseMessage(StreamResponseMessage responseMessage)
                             throws IOException
Throws:
IOException

createConnection

protected abstract Connection createConnection()


Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.