org.apache.tomcat.bayeux
Class RequestBase

java.lang.Object
  extended by org.apache.tomcat.bayeux.RequestBase
All Implemented Interfaces:
BayeuxRequest
Direct Known Subclasses:
MetaConnectRequest, MetaDisconnectRequest, MetaHandshakeRequest, MetaSubscribeRequest, MetaUnsubscribeRequest, PublishRequest

public abstract class RequestBase
extends java.lang.Object
implements BayeuxRequest

Common functionality and member variables for all Bayeux requests.

Version:
0.9
Author:
Guy A. Molinari, Filip Hanik

Field Summary
protected  java.lang.String channel
           
protected  java.lang.String clientId
           
protected  java.lang.String conType
           
protected  java.lang.String data
           
protected  int desiredConnTypeFlag
           
protected  org.jboss.servlet.http.HttpEvent event
           
protected  java.util.LinkedHashMap<java.lang.String,java.lang.Object> ext
           
protected  java.lang.String id
           
protected  java.lang.String minVersion
           
protected  int reconnectInterval
           
protected  java.util.HashMap<java.lang.String,java.lang.Object> response
           
protected  java.lang.String subscription
           
protected  java.lang.String[] suppConnTypes
           
protected  int suppConnTypesFlag
           
protected static java.text.SimpleDateFormat timestampFmt
           
protected  TomcatBayeux tomcatBayeux
           
protected  java.lang.String version
           
 
Fields inherited from interface org.apache.tomcat.bayeux.BayeuxRequest
CURRENT_REQ_ATTR, JSON_MSG_ARRAY, LAST_REQ_ATTR
 
Constructor Summary
protected RequestBase(TomcatBayeux tb, org.jboss.servlet.http.HttpEvent event, JSONObject jsReq)
           
 
Method Summary
protected  void addToDeliveryQueue(ClientImpl to, JSONObject msg)
           
protected static void deliver(org.jboss.servlet.http.HttpEvent event, ClientImpl to)
           
protected  void flushMessages(ClientImpl client)
           
 java.lang.String getChannel()
           
 java.lang.String getClientId()
           
 org.jboss.servlet.http.HttpEvent getEvent()
           
 java.util.LinkedHashMap getExt()
           
 java.lang.String getId()
           
protected  JSONArray getJSONArray()
           
protected static JSONArray getJSONArray(org.jboss.servlet.http.HttpEvent event, boolean nullok)
           
 int getReconnectInterval()
           
 java.lang.String getTimeStamp()
           
 TomcatBayeux getTomcatBayeux()
           
 int process(int prevops)
          processes a remote client Bayeux message
 HttpError validate()
          Validates a specific request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timestampFmt

protected static final java.text.SimpleDateFormat timestampFmt

tomcatBayeux

protected TomcatBayeux tomcatBayeux

channel

protected java.lang.String channel

id

protected java.lang.String id

clientId

protected java.lang.String clientId

version

protected java.lang.String version

suppConnTypes

protected java.lang.String[] suppConnTypes

suppConnTypesFlag

protected int suppConnTypesFlag

desiredConnTypeFlag

protected int desiredConnTypeFlag

minVersion

protected java.lang.String minVersion

subscription

protected java.lang.String subscription

data

protected java.lang.String data

conType

protected java.lang.String conType

ext

protected java.util.LinkedHashMap<java.lang.String,java.lang.Object> ext

event

protected org.jboss.servlet.http.HttpEvent event

response

protected java.util.HashMap<java.lang.String,java.lang.Object> response

reconnectInterval

protected int reconnectInterval
Constructor Detail

RequestBase

protected RequestBase(TomcatBayeux tb,
                      org.jboss.servlet.http.HttpEvent event,
                      JSONObject jsReq)
               throws JSONException
Throws:
JSONException
Method Detail

validate

public HttpError validate()
Description copied from interface: BayeuxRequest
Validates a specific request. This method must be called prior to process() as a request can do pre processing in the validate method.
Should the validation fail, an error object is returned containing an error message, and potentially a stack trace if an exception was generated

Specified by:
validate in interface BayeuxRequest
Returns:
HttpError - null if no error was detected, an HttpError object containing information about the error.

getTomcatBayeux

public TomcatBayeux getTomcatBayeux()

getChannel

public java.lang.String getChannel()

getId

public java.lang.String getId()

getClientId

public java.lang.String getClientId()

getExt

public java.util.LinkedHashMap getExt()

getEvent

public org.jboss.servlet.http.HttpEvent getEvent()

deliver

protected static void deliver(org.jboss.servlet.http.HttpEvent event,
                              ClientImpl to)
                       throws java.io.IOException,
                              javax.servlet.ServletException,
                              BayeuxException
Throws:
java.io.IOException
javax.servlet.ServletException
BayeuxException

getJSONArray

protected static JSONArray getJSONArray(org.jboss.servlet.http.HttpEvent event,
                                        boolean nullok)

getJSONArray

protected JSONArray getJSONArray()

addToDeliveryQueue

protected void addToDeliveryQueue(ClientImpl to,
                                  JSONObject msg)
                           throws java.io.IOException,
                                  javax.servlet.ServletException,
                                  BayeuxException
Throws:
java.io.IOException
javax.servlet.ServletException
BayeuxException

flushMessages

protected void flushMessages(ClientImpl client)
                      throws BayeuxException
Throws:
BayeuxException

process

public int process(int prevops)
            throws BayeuxException
Description copied from interface: BayeuxRequest
processes a remote client Bayeux message

Specified by:
process in interface BayeuxRequest
Parameters:
prevops - - the operation requested by the previous request, in case of chained requests.
Returns:
int - returns the interest operation for a CometEvent. Currently not used
Throws:
BayeuxException - - if an error was detected, and the appropriate error response couldn't be delivered to the client.

getReconnectInterval

public int getReconnectInterval()

getTimeStamp

public java.lang.String getTimeStamp()


Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.