Project Wonder 5.0

er.ajax
Class AjaxPushRequestHandler

java.lang.Object
  extended by com.webobjects.appserver.WORequestHandler
      extended by er.ajax.AjaxPushRequestHandler

public class AjaxPushRequestHandler
extends com.webobjects.appserver.WORequestHandler

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

    Field Summary
    static java.lang.String AjaxCometRequestHandlerKey
               
    protected static org.apache.log4j.Logger log
               
     
    Fields inherited from class com.webobjects.appserver.WORequestHandler
    DidHandleRequestNotification
     
    Constructor Summary
    AjaxPushRequestHandler()
               
     
    Method Summary
     com.webobjects.appserver.WOResponse handleRequest(com.webobjects.appserver.WORequest request)
              Get/Create the current request for the session and return it.
    static boolean isResponseOpen(java.lang.String sessionID, java.lang.String name)
              Returns whether or not there is a response open for the given session id and name.
    static void push(java.lang.String sessionID, java.lang.String name, com.webobjects.foundation.NSData message)
              Push a data message to the client.
    static void push(java.lang.String sessionID, java.lang.String name, java.lang.String message)
              Push a string message to the client.
     void sessionDidTimeOut(com.webobjects.foundation.NSNotification n)
              Remove stale responses when a session times out.
    static void stop(java.lang.String sessionID, java.lang.String name)
              Push a string message to the client.
     
    Methods inherited from class com.webobjects.appserver.WORequestHandler
    toString
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    AjaxCometRequestHandlerKey

    public static final java.lang.String AjaxCometRequestHandlerKey
    See Also:
    Constant Field Values

    log

    protected static org.apache.log4j.Logger log
    Constructor Detail

    AjaxPushRequestHandler

    public AjaxPushRequestHandler()
    Method Detail

    sessionDidTimeOut

    public void sessionDidTimeOut(com.webobjects.foundation.NSNotification n)
    Remove stale responses when a session times out.

    Parameters:
    n - the session timeout notification

    handleRequest

    public com.webobjects.appserver.WOResponse handleRequest(com.webobjects.appserver.WORequest request)
    Get/Create the current request for the session and return it.

    Specified by:
    handleRequest in class com.webobjects.appserver.WORequestHandler
    Parameters:
    request - the request

    isResponseOpen

    public static boolean isResponseOpen(java.lang.String sessionID,
                                         java.lang.String name)
    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

    stop

    public static void stop(java.lang.String sessionID,
                            java.lang.String name)
    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

    push

    public static void push(java.lang.String sessionID,
                            java.lang.String name,
                            java.lang.String message)
    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

    push

    public static void push(java.lang.String sessionID,
                            java.lang.String name,
                            com.webobjects.foundation.NSData message)
    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

    Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

    Copyright © 2002 – 2007 Project Wonder.