FileDocCategorySizeDatePackage
Subscribe.javaAPI DocGlassfish v2 API4175Tue Jun 19 17:49:08 BST 2007com.sun.grizzly.cometd.bayeux

Subscribe

public 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

Fields Summary
protected String
subscription
protected Advice
advise
protected String
clientId
protected String
error
Constructors Summary
public Subscribe()

    
    
      
        type = Verb.SUBSCRIBE;
    
Methods Summary
public AdvicegetAdvise()

        return advise;
    
public java.lang.StringgetClientId()

        return clientId;
    
public java.lang.StringgetError()

        return error;
    
public java.lang.StringgetSubscription()

        return subscription;
    
public voidsetAdvise(Advice advise)

        this.advise = advise;
    
public voidsetClientId(java.lang.String clientId)

        this.clientId = clientId;
    
public voidsetError(java.lang.String error)

        this.error = error;
    
public voidsetSubscription(java.lang.String subscription)

        this.subscription = subscription;
    
public java.lang.StringtoJSON()

        
        return "[{"     
                + "\"subscription\":\"" + subscription + "\","                 
                + "\"error\":\"" + error + "\","
                + "\"successful\":" + successful + ","                
                + "\"channel\":\"" + channel + "\""
                + "}]\n";