AjaxPushRequestHandler Class Reference

Inherits com::webobjects::appserver::WORequestHandler.

Collaboration diagram for AjaxPushRequestHandler:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 AjaxPushRequestHandler ()
WOResponse handleRequest (WORequest request)
void sessionDidTimeOut (NSNotification n)

Static Public Member Functions

static boolean isResponseOpen (String sessionID, String name)
static void push (String sessionID, String name, NSData message)
static void push (String sessionID, String name, String message)
static void stop (String sessionID, String name)

Static Public Attributes

static final String AjaxCometRequestHandlerKey = "push"

Static Protected Attributes

static Logger log = Logger.getLogger(AjaxPushRequestHandler.class)

Static Private Member Functions

static ERXKeepAliveResponse responseForSessionIDNamed (String sessionID, String name)

Static Private Attributes

static ConcurrentHashMap
< String, ConcurrentHashMap
< String, ERXKeepAliveResponse > > 
responses = new ConcurrentHashMap<String, ConcurrentHashMap<String, ERXKeepAliveResponse>>()


Detailed Description

Request handler that offers push-style notifications.
Gets registered under "/push/" on framework load.
You should open an Ajax.Request, implement onInteractive: and the do something useful when you get new data. Changes should be pushed with push(sessionID, someString);

TODO: currently the request stays open even when the client closed it (which is bad) implement a boundary scheme to tell when a "message" is complete. This means we need a special Ajax.Request that does it. implement various client-side stuff to be actually useful (chats, EO notifications). ask Frank about his EO layer use the request handler path as a "topic", so we can have more than one on a page.

Author:
ak

Constructor & Destructor Documentation


Member Function Documentation

WOResponse handleRequest ( WORequest  request  ) 

Get/Create the current request for the session and return it.

Parameters:
request the request

static boolean isResponseOpen ( String  sessionID,
String  name 
) [static]

Returns whether or not there is a response open for the given session id and name.

Parameters:
sessionID the session id of the push response
name the name of the push response
Returns:
whether or not there is still a response open

static void push ( String  sessionID,
String  name,
NSData  message 
) [static]

Push a data message to the client. At the moment, there is no boundary handling, so be aware that you could get only half of a message.

Parameters:
sessionID the session id of the push response
name the name of the push response
message the message to push

static void push ( String  sessionID,
String  name,
String  message 
) [static]

Push a string message to the client. At the moment, there is no boundary handling, so be aware that you could get only half of a message.

Parameters:
sessionID the session id of the push response
name the name of the push response
message the message to push

static ERXKeepAliveResponse responseForSessionIDNamed ( String  sessionID,
String  name 
) [static, private]

Return or create the correct response for the session ID.

Parameters:
sessionID the session id of the response
name the name of the response
Returns:
response for ID

void sessionDidTimeOut ( NSNotification  n  ) 

Remove stale responses when a session times out.

Parameters:
n the session timeout notification

static void stop ( String  sessionID,
String  name 
) [static]

Push a string message to the client. At the moment, there is no boundary handling, so be aware that you could get only half of a message.

Parameters:
sessionID the session id of the push response
name the name of the push response


Member Data Documentation

final String AjaxCometRequestHandlerKey = "push" [static]

Logger log = Logger.getLogger(AjaxPushRequestHandler.class) [static, protected]

ConcurrentHashMap<String, ConcurrentHashMap<String, ERXKeepAliveResponse> > responses = new ConcurrentHashMap<String, ConcurrentHashMap<String, ERXKeepAliveResponse>>() [static, private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:38 2012 for Project Wonder by  doxygen 1.5.8