org.persvr.servlet
Class Channels

java.lang.Object
  extended by HttpServlet
      extended by org.persvr.servlet.Channels
Direct Known Subclasses:
Bayeux, TomcatChannels

public class Channels
extends HttpServlet

This is an HTTP Channels implementation that provides HTTP tunneling for duplex Comet-style RESTian communication. This will utilize Jetty continuations if available so that thread blocking is not necessary. If Jetty is not available, thread blocking (which is less efficient) will be used to keep the connection open. If you are using Tomcat, you should use the TomcatChannels servlet.

Author:
Kris

Nested Class Summary
static class Channels.ConnectionConflictException
           
 
Field Summary
static int COMET_TIMEOUT
           
 
Constructor Summary
Channels()
           
 
Method Summary
protected  void doGet(HttpServletRequest req, HttpServletResponse resp)
           
protected  void doPost(HttpServletRequest req, HttpServletResponse resp)
           
protected  org.persvr.servlet.Channels.CometSerializer getCometSerializer(HttpServletRequest request)
           
protected  EventStream getEventStream(HttpServletRequest req)
           
protected  boolean isHttpStreamAcceptable(HttpServletRequest request)
          Determine if streaming is available based on proxy indications and user agent string
protected  boolean sendEvent(EventStream.Notification notification, EventStream eventStreamer, org.persvr.servlet.Channels.CometSerializer serializer)
           
protected  EventStream.Notification suspend(EventStream eventStreamer, HttpServletRequest request)
          Suspend the current request using whatever technology is available (preferably without blocking threads)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMET_TIMEOUT

public static final int COMET_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

Channels

public Channels()
Method Detail

suspend

protected EventStream.Notification suspend(EventStream eventStreamer,
                                           HttpServletRequest request)
                                    throws java.io.IOException
Suspend the current request using whatever technology is available (preferably without blocking threads)

Parameters:
eventStreamer -
activeStream -
request -
stream -
Returns:
Throws:
java.io.IOException

isHttpStreamAcceptable

protected boolean isHttpStreamAcceptable(HttpServletRequest request)
Determine if streaming is available based on proxy indications and user agent string

Parameters:
request -
Returns:

getCometSerializer

protected org.persvr.servlet.Channels.CometSerializer getCometSerializer(HttpServletRequest request)

getEventStream

protected EventStream getEventStream(HttpServletRequest req)
                              throws java.io.IOException
Throws:
java.io.IOException

sendEvent

protected boolean sendEvent(EventStream.Notification notification,
                            EventStream eventStreamer,
                            org.persvr.servlet.Channels.CometSerializer serializer)
                     throws java.io.IOException
Throws:
java.io.IOException

doGet

protected void doGet(HttpServletRequest req,
                     HttpServletResponse resp)
              throws ServletException,
                     java.io.IOException
Throws:
ServletException
java.io.IOException

doPost

protected void doPost(HttpServletRequest req,
                      HttpServletResponse resp)
               throws ServletException,
                      java.io.IOException
Throws:
ServletException
java.io.IOException