com.sun.grizzly.cometd.bayeux
Class Subscribe

java.lang.Object
  extended by com.sun.grizzly.cometd.bayeux.VerbBase
      extended by com.sun.grizzly.cometd.bayeux.Subscribe
All Implemented Interfaces:
Verb
Direct Known Subclasses:
SubscribeRequest, SubscribeResponse, Unsubscribe

public abstract class Subscribe
extends VerbBase

Bayeux Subscribe implementation. See http://svn.xantus.org/shortbus/trunk/bayeux/protocol.txt for the technical details. // Subscribing and unsubscribing to channel is straightforward. Subscribing: //----------------- // CLIENT -> SERVER //----------------- [ { "channel": "/meta/subscribe", "subscription": "/some/other/channel", // optional "authToken": "SOME_NONCE_PREVIOUSLY_PROVIDED_BY_SERVER" } // , ... ] // response to subscription: //----------------- // SERVER -> CLIENT //----------------- [ { "channel": "/meta/subscribe", "subscription": "/some/other/channel", "successful": true, "advice": { "transport": { retry: true, // or false } }, "clientId": "SOME_UNIQUE_CLIENT_ID", "error": "", // optional "authToken": "SOME_NONCE" } // , ... ]

Author:
Jeanfrancois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.grizzly.cometd.bayeux.Verb
Verb.Type
 
Field Summary
static String META_SUBSCRIBE
           
protected  String subscription
           
 
Fields inherited from class com.sun.grizzly.cometd.bayeux.VerbBase
advice, authToken, channel, clientId, data, dataId, error, ext, first, follow, id, last, metaChannel, successful, type
 
Constructor Summary
Subscribe()
           
 
Method Summary
protected  String getBody(boolean isResponse, String timestamp)
           
 String getSubscription()
           
 boolean isValid()
          Check whether the Verb is valid.
 void setSubscription(String subscription)
           
 
Methods inherited from class com.sun.grizzly.cometd.bayeux.VerbBase
getAdvice, getAuthToken, getChannel, getClientId, getData, getDataId, getExt, getId, getJSONPostfix, getJSONPrefix, getMetaChannel, getType, hasValidAdvice, isFirst, isFollow, isLast, setAdvice, setAuthToken, setChannel, setClientId, setData, setDataId, setExt, setFirst, setFollow, setId, setLast, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.grizzly.cometd.bayeux.Verb
toJSON
 

Field Detail

META_SUBSCRIBE

public static final String META_SUBSCRIBE
See Also:
Constant Field Values

subscription

protected String subscription
Constructor Detail

Subscribe

public Subscribe()
Method Detail

getSubscription

public String getSubscription()

setSubscription

public void setSubscription(String subscription)

isValid

public boolean isValid()
Description copied from interface: Verb
Check whether the Verb is valid.

Specified by:
isValid in interface Verb
Overrides:
isValid in class VerbBase

getBody

protected String getBody(boolean isResponse,
                         String timestamp)
Parameters:
isResponse -
printTimestamp - for UnsubscribeResponse


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.