Class FCMMessagePublisher

  • All Implemented Interfaces:
    MessagePublisher

    public class FCMMessagePublisher
    extends Object
    implements MessagePublisher
    Message publisher using the HTTP API v1 of Firebase Cloud Messaging
    • Constructor Detail

      • FCMMessagePublisher

        public FCMMessagePublisher​(org.exoplatform.container.xml.InitParams initParams,
                                   org.exoplatform.services.resources.ResourceBundleService resourceBundleService,
                                   org.exoplatform.commons.api.notification.service.WebNotificationService webNotificationService)
      • FCMMessagePublisher

        public FCMMessagePublisher​(org.exoplatform.container.xml.InitParams initParams,
                                   org.exoplatform.services.resources.ResourceBundleService resourceBundleService,
                                   org.exoplatform.commons.api.notification.service.WebNotificationService webNotificationService,
                                   org.apache.http.impl.client.CloseableHttpClient httpClient)
    • Method Detail

      • convertHtml

        protected String convertHtml​(String html)
        Conserve line breaks of br and p elements in a html document
      • processBody

        protected String processBody​(Message message)
        Process the notification message body: * replace images by a text "inline image" * escape double quotes
        Parameters:
        message - The raw message body
        Returns:
        The transformed message body
      • getPrivateKeyFromPkcs8

        protected PrivateKey getPrivateKeyFromPkcs8​(String privateKeyPem)
                                             throws IOException
        Build a PrivateKey from its string value
        Parameters:
        privateKeyPem - Private key value
        Returns:
        PrivateKey
        Throws:
        IOException
      • getAccessToken

        protected String getAccessToken()
                                 throws IOException
        Retrieve the access token
        Returns:
        The access token
        Throws:
        IOException