Package org.cometd.client.transport

Examples of org.cometd.client.transport.LongPollingTransport


            case LONG_POLLING:
            {
                Map<String, Object> options = new HashMap<>();
                options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
                options.put(ClientTransport.MAX_NETWORK_DELAY_OPTION, Config.MAX_NETWORK_DELAY);
                return new LongPollingTransport(options, httpClient);
            }
            case JSR_WEBSOCKET:
            {
                Map<String, Object> options = new HashMap<>();
                options.put(ClientTransport.JSON_CONTEXT_OPTION, new Jackson1JSONContextClient());
View Full Code Here


 
  private static BayeuxClient createBayeuxClient(Setup builder) {
    final Authentication authentication = builder.authentication;
   
    HashMap<String, Object> longPollingOptions = new HashMap<>();   
    LongPollingTransport longPollingTransport = new LongPollingTransport(longPollingOptions, builder.client.httpClient) {

      @Override protected void customize(ContentExchange exchange) {
        super.customize(exchange);
        HttpRequest request = new Jetty769HttpRequest(exchange);
        authentication.setupRequest(request);
        logRequest(exchange);
      }
     
      @Override protected void debug(String message, Object... args) {
        LOG_EVENT_TRANSPORT.debug(message, args);
      }
     
    };

    // Transports are set the cookieProvider *after* creating the bayeuxClient, because
    // BayeuxClient invariably sets its own cookieProvider inside the constructor.
    BayeuxClient bayeuxClient;   
    if (builder.webSocketEnabled) {
      WebSocketTransport webSocketTransport = createWebSocketTransport();
      bayeuxClient = new BayeuxClient(builder.client.serverUri + "/api/v2/notifications", webSocketTransport, longPollingTransport);
      webSocketTransport.setCookieProvider(builder.cookieSession.getCookieProvider());
    } else {
      bayeuxClient = new BayeuxClient(builder.client.serverUri + "/api/v2/notifications", longPollingTransport);
    }
    longPollingTransport.setCookieProvider(builder.cookieSession.getCookieProvider());
   
    return bayeuxClient;
  }
View Full Code Here

  public void init() throws Exception {
    // Prepare the HTTP transport
    HttpClient httpClient = new HttpClient();
    httpClient.start();
    ClientTransport  httpTransport = new LongPollingTransport(null, httpClient);

    // Configure the BayeuxClient, with the websocket transport listed before the http transport
    BayeuxClient client = new BayeuxClient("http://localhost:8080/cometd", httpTransport);

    // Handshake
View Full Code Here

        if (session.getAccessToken() == null) {
            // lazy login here!
            session.login(null);
        }

        LongPollingTransport transport = new LongPollingTransport(options, httpClient) {
            @Override
            protected void customize(ContentExchange exchange) {
                super.customize(exchange);
                // add SalesforceSecurityListener to handle token expiry
                final String accessToken = session.getAccessToken();
View Full Code Here

TOP

Related Classes of org.cometd.client.transport.LongPollingTransport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.