Sends an FCM message to the given set of registration tokens with the given request payload.

@param registrationTokens the devices to send a message to.
@param request            the details of the message.
@return the result of sending the message.
331735
@Override
  public FcmSendMessageResult sendMessageToRegistrationTokens(
      final Collection<String> registrationTokens,
      final FcmSendMessageRequest request
  ) {
    return proxy.sendMessageToRegistrationTokens(registrationTokens, request);
  }
57675
public Member register(RegistrationRequest registrationRequest) throws RegistrationException {
        Member member = getMember(registrationRequest.getEnrollmentID());
	    member.register(registrationRequest);
	    return member;
    }
356609
public Future<SendMessageResult> sendMessage(SendMessageRequest request,
                                                 AsyncHandler<SendMessageRequest, SendMessageResult> handler) {
        QueueBufferCallback<SendMessageRequest, SendMessageResult> callback = null;
        if (handler != null) {
            callback = new QueueBufferCallback<SendMessageRequest, SendMessageResult>(handler, request);
        }
        QueueBufferFuture<SendMessageRequest, SendMessageResult> future = sendBuffer.sendMessage(request, callback);
        future.setBuffer(this);
        return future;
    }
215195
protected void sendClientRequest(HttpMessage request) {
        BuilderSupport<HttpActionBuilder> action = builder -> {
            HttpClientActionBuilder.HttpClientSendActionBuilder sendBuilder = builder.client(httpClient).send();
            HttpClientRequestActionBuilder requestBuilder;

            if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
                requestBuilder = sendBuilder.post().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.GET)) {
                requestBuilder = sendBuilder.get().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
                requestBuilder = sendBuilder.put().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
                requestBuilder = sendBuilder.delete().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
                requestBuilder = sendBuilder.head().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
                requestBuilder = sendBuilder.trace().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
                requestBuilder = sendBuilder.patch().message(request);
            } else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
                requestBuilder = sendBuilder.options().message(request);
            } else {
                requestBuilder = sendBuilder.post().message(request);
            }

            if (StringUtils.hasText(url)) {
                requestBuilder.uri(url);
            }
        };

        runner.http(action);
    }
987892
public ListVpcsResponse listVpcs(ListVpcsRequest request) {
        checkNotNull(request, "request should not be null.");
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VPC_PREFIX);
        if (request.getMarker() != null) {
            internalRequest.addParameter("marker", request.getMarker());
        }
        if (request.getMaxKeys() > 0) {
            internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
        }
        if (request.getIsDefault() != null) {
            internalRequest.addParameter("isDefault", request.getIsDefault().toString());
        }
        return invokeHttpClient(internalRequest, ListVpcsResponse.class);
    }
1060546
private void dispatchRequest(final CouchbaseRequest request) {
        RingBufferMonitor.instance().removeRequest(request);

        ClusterConfig config = configuration;

        //prevent non-bootstrap requests to go through if bucket not part of config
        if (!(request instanceof BootstrapMessage)) {
            BucketConfig bucketConfig = config == null ? null : config.bucketConfig(request.bucket());
            if (config == null || (request.bucket() != null  && bucketConfig == null)) {
                failSafe(environment.scheduler(), true, request.observable(),
                        new BucketClosedException(request.bucket() + " has been closed"));
                return;
            }

            //short-circuit some kind of requests for which we know there won't be any handler to respond.
            try {
                checkFeaturesForRequest(request, bucketConfig);
            } catch (ServiceNotAvailableException e) {
                failSafe(environment.scheduler(), true, request.observable(), e);
                return;
            }

            //don't send timed out requests to server
            if(!request.isActive()) {
                return;
            }
        }

        locator(request).locateAndDispatch(request, nodes, config, environment, responseBuffer);
    }
1027194
public static void bind(HttpServletRequest request) {
        if (request != null && threadLocal.get() != null) {
            throw new IllegalStateException("HttpServletRequestHolder.bind() called for a "
                    + "thread that already has a request associated with it. It's likely that the request "
                    + "was not correctly removed from the thread before it is put back into the thread pool.");
        }
        threadLocal.set(request);
    }
129916
public static AuthenticationResult authenticationResultFromRequest(final HttpServletRequest request)
  {
    final AuthenticationResult authenticationResult = (AuthenticationResult) request.getAttribute(
        AuthConfig.DRUID_AUTHENTICATION_RESULT
    );

    if (authenticationResult == null) {
      throw new ISE("Null authentication result");
    }

    return authenticationResult;
  }
717919
public static Request registerRequest(Request req) {
    assert req.supportedVersions().length > 0;
    for (API_VERSION ver : req.supportedVersions()) {
      String href = req.href(ver);
      assert (! _requests.containsKey(href)) : "Request with href "+href+" already registered";
      _requests.put(href,req);
      req.registered(ver);
    }
    return req;
  }
1225840
public CreateNotificationResponse createNotification(CreateNotificationRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getName(),
                "The parameter name should NOT be null or empty string.");
        checkStringNotEmpty(request.getEndpoint(),
                "The parameter endpoint should NOT be null or empty string.");

        InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_NOTIFICATION);
        return invokeHttpClient(internalRequest, CreateNotificationResponse.class);
    }
388560
private void addPostParams(final Request request) {
        if (identity != null) {
            for (String prop : identity) {
                request.addPostParam("Identity", prop);
            }
        }

        if (tag != null) {
            for (String prop : tag) {
                request.addPostParam("Tag", prop);
            }
        }

        if (body != null) {
            request.addPostParam("Body", body);
        }

        if (priority != null) {
            request.addPostParam("Priority", priority.toString());
        }

        if (ttl != null) {
            request.addPostParam("Ttl", ttl.toString());
        }

        if (title != null) {
            request.addPostParam("Title", title);
        }

        if (sound != null) {
            request.addPostParam("Sound", sound);
        }

        if (action != null) {
            request.addPostParam("Action", action);
        }

        if (data != null) {
            request.addPostParam("Data", Converter.mapToJson(data));
        }

        if (apn != null) {
            request.addPostParam("Apn", Converter.mapToJson(apn));
        }

        if (gcm != null) {
            request.addPostParam("Gcm", Converter.mapToJson(gcm));
        }

        if (sms != null) {
            request.addPostParam("Sms", Converter.mapToJson(sms));
        }

        if (facebookMessenger != null) {
            request.addPostParam("FacebookMessenger", Converter.mapToJson(facebookMessenger));
        }

        if (fcm != null) {
            request.addPostParam("Fcm", Converter.mapToJson(fcm));
        }

        if (segment != null) {
            for (String prop : segment) {
                request.addPostParam("Segment", prop);
            }
        }

        if (alexa != null) {
            request.addPostParam("Alexa", Converter.mapToJson(alexa));
        }

        if (toBinding != null) {
            for (String prop : toBinding) {
                request.addPostParam("ToBinding", prop);
            }
        }
    }
1037742
public void request(int numMessages) {
        if (subscription == null) {
            deferredInitialMessageRequest += numMessages;
            return;
        }
        deframer.request(numMessages);
        requestHttpFrame();
    }
60616
public void registerPushServicesWithToken(final String token) {
        String httpURI;
        String httpMethod;

        JSONObject data = new JSONObject();
        try {
            data.put("token", token);
            data.put("service", "google");

            SharedPreferences prefs = appContext.getSharedPreferences(appContext.getPackageName(), Context.MODE_PRIVATE);

            if (null != prefs) {
                String lastKnownPushToken = prefs.getString(PROPERTY_LAST_VALID_PUSH_TOKEN, "notAvailable");
                String lastKnownPushTokenID = prefs.getString(PROPERTY_LAST_VALID_PUSH_TOKEN_ID, "notAvailable");

                if ((null == lastKnownPushTokenID) || (lastKnownPushTokenID.equals("notAvailable"))) {
                    httpURI = String.format("/v1/connections/%s/push-token", localConnectionID);
                    httpMethod = "post";
                    createOrUpdatePushServiceToken(token, httpURI, httpMethod, data, prefs);
                } else if (!lastKnownPushToken.equals("notAvailable") && !lastKnownPushToken.equals(token)) {
                    httpURI = String.format("/v1/connections/%s/push-token/%s", localConnectionID, lastKnownPushTokenID);
                    httpMethod = "put";
                    createOrUpdatePushServiceToken(token, httpURI, httpMethod, data, prefs);
                }
            }
        } catch(JSONException e) {
            Log.d("", "Invalid JSON format for token");
        }
    }
1176099
public synchronized void remoteServerRegistrations(RESTRequest request) {
        Iterator<Entry<NotificationTargetInformation, List<ServerNotification>>> serverNotificationsIter = serverNotifications.entrySet().iterator();
        while (serverNotificationsIter.hasNext()) {
            Entry<NotificationTargetInformation, List<ServerNotification>> entry = serverNotificationsIter.next();
            NotificationTargetInformation nti = entry.getKey();

            // Check whether the producer of the notification is local or remote.
            if (nti.getRoutingInformation() == null) {
                //Traverse the list for that ObjectName
                ObjectName objName = RESTHelper.objectNameConverter(nti.getNameAsString(), false, null);

                if (MBeanServerHelper.isRegistered(objName)) {
                    for (ServerNotification notification : entry.getValue()) {
                        MBeanServerHelper.removeServerNotification(objName,
                                                                   notification.listener,
                                                                   (NotificationFilter) getObject(notification.filter, null, null),
                                                                   getObject(notification.handback, null, null),
                                                                   null);
                    }
                }
                else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "The MBean is not registered with the MBean server.");
                    }
                }
            } else {
                // Remove the notification listener from the Target-Client Manager through EventAdmin
                MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
                for (ServerNotification notification : entry.getValue()) {
                    helper.removeRoutedServerNotificationListener(nti,
                                                                  notification.listener,
                                                                  (NotificationFilter) getObject(notification.filter, null, null),
                                                                  getObject(notification.handback, null, null),
                                                                  null);
                }
            }
        }
        //Clear the map
        serverNotifications.clear();

        //We don't have any more server notifications, so we can clear our library
        clearObjectLibrary();
    }
481991
public void bindEip(BindEipRequest request) {
        checkStringNotEmpty(request.getEip(), "eip should not be empty");
        if (Strings.isNullOrEmpty(request.getClientToken())) {
            request.setClientToken(generateDefaultClientToken());
        }
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, request.getEip());
        internalRequest.addParameter("bind", null);
        internalRequest.addParameter(CLIENT_TOKEN_IDENTIFY, request.getClientToken());
        fillPayload(internalRequest, request);
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
1281583
private void addPostParams(final Request request) {
        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (apnCredentialSid != null) {
            request.addPostParam("ApnCredentialSid", apnCredentialSid);
        }

        if (gcmCredentialSid != null) {
            request.addPostParam("GcmCredentialSid", gcmCredentialSid);
        }

        if (messagingServiceSid != null) {
            request.addPostParam("MessagingServiceSid", messagingServiceSid);
        }

        if (facebookMessengerPageId != null) {
            request.addPostParam("FacebookMessengerPageId", facebookMessengerPageId);
        }

        if (defaultApnNotificationProtocolVersion != null) {
            request.addPostParam("DefaultApnNotificationProtocolVersion", defaultApnNotificationProtocolVersion);
        }

        if (defaultGcmNotificationProtocolVersion != null) {
            request.addPostParam("DefaultGcmNotificationProtocolVersion", defaultGcmNotificationProtocolVersion);
        }

        if (fcmCredentialSid != null) {
            request.addPostParam("FcmCredentialSid", fcmCredentialSid);
        }

        if (defaultFcmNotificationProtocolVersion != null) {
            request.addPostParam("DefaultFcmNotificationProtocolVersion", defaultFcmNotificationProtocolVersion);
        }

        if (logEnabled != null) {
            request.addPostParam("LogEnabled", logEnabled.toString());
        }

        if (alexaSkillId != null) {
            request.addPostParam("AlexaSkillId", alexaSkillId);
        }

        if (defaultAlexaNotificationProtocolVersion != null) {
            request.addPostParam("DefaultAlexaNotificationProtocolVersion", defaultAlexaNotificationProtocolVersion);
        }
    }
1093916
public void notifyObserversOfRequestFailure(CachedSpiceRequest<?> request) {
        RequestProcessingContext requestProcessingContext = new RequestProcessingContext();
        requestProcessingContext.setExecutionThread(Thread.currentThread());
        post(new RequestFailedNotifier(request, spiceServiceListenerList, requestProcessingContext));
    }