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

Handshake

public class Handshake extends VerbBase
Bayeux Handshake implementation. See http://svn.xantus.org/shortbus/trunk/bayeux/protocol.txt for the technical details. This is an example of the messages exchanged during a connection setup process: // from client, to server [ { "channel": "/meta/handshake", // all meta channel messages MUST contain the protocol version the // client expects "version": 0.1, // the oldest version of the protocol that this client will support "minimumVersion": 0.1, "supportedConnectionTypes": ["iframe", "flash", "http-polling"], // the authScheme is outside the realm of this specification and // provided here for illustration only. It's also optional. "authScheme": "SHA1", // the authUser and authToken are optional and authScheme dependent "authUser": "alex", "authToken": "HASHJIBBERISH" } // servers MUST ignore other messages in the envelope should the first // be a handshake request ] // from server, to client [ { "channel": "/meta/handshake", // preferred protocol version "version": 0.1, // the oldest version of the protocol that this server will support "minimumVersion": 0.1, "supportedConnectionTypes": ["iframe", "flash", "http-polling"], "clientId": "SOME_UNIQUE_CLIENT_ID", "authSuccessful": true, // authToken is auth scheme dependent and entirely optional "authToken": "SOME_NONCE_THAT_NEEDS_TO_BE_PROVIDED_SUBSEQUENTLY", // advice determines the client behavior on errors "advice": { "reconnect": "retry", // one of "none", "retry", "handshake", "recover" // transport specializations of the top-level generalized // advice "transport": { "iframe": { }, "flash": { }, "http-polling": { // delay before reconnecting "interval": 5000 // ms } } } } // servers MUST send only a handshake message in response to a handshake request ]
author
Jeanfrancois Arcand

Fields Summary
private String
version
private String
minimumVersion
private String
supportedConnectionTypes
private String
authScheme
private String
authUser
private String
clientId
private Boolean
authSuccessful
private Advice
advice
private boolean
successfull
Constructors Summary
public Handshake()


      
        type = Verb.HANDSHAKE;
    
Methods Summary
public AdvicegetAdvice()

        return advice;
    
public java.lang.StringgetAuthScheme()

        return authScheme;
    
public java.lang.BooleangetAuthSuccessful()

        return authSuccessful;
    
public java.lang.StringgetAuthUser()

        return authUser;
    
public java.lang.StringgetClientId()

        return clientId;
    
public java.lang.StringgetMinimumVersion()

        return minimumVersion;
    
public java.lang.StringgetSupportedConnectionTypes()

        return supportedConnectionTypes;
    
public java.lang.StringgetVersion()

        return version;
    
public voidsetAdvice(Advice advice)

        this.advice = advice;
    
public voidsetAuthScheme(java.lang.String authScheme)

        this.authScheme = authScheme;
    
public voidsetAuthSuccessful(java.lang.Boolean authSuccessful)

        this.authSuccessful = authSuccessful;
    
public voidsetAuthUser(java.lang.String authUser)

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

        this.clientId = clientId;
    
public voidsetMinimumVersion(java.lang.String minimumVersion)

        this.minimumVersion = minimumVersion;
    
public voidsetSupportedConnectionTypes(java.lang.String supportedConnectionTypes)

        this.supportedConnectionTypes = supportedConnectionTypes;
    
public voidsetVersion(java.lang.String version)

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

        
        return "[{" 
                + "\"supportedConnectionTypes\":" + supportedConnectionTypes + ","                 
                + "\"minimumVersion\":" + minimumVersion + ","
                + "\"authSuccessful\":" + authSuccessful + ","  
                + ext.toJSON() + ","
                + "\"clientId\":\"" + clientId + "\","     
                + "\"successful\":" + successful + ","  
                + "\"channel\":\"" + channel + "\","                  
                + advice.toJSON() + ","   
                + "\"version\":" + version
                + "}]\n";              
    
public java.lang.StringtoString()

        return toJSON();