Class PushResult

java.lang.Object
com.codename1.backend.push.PushResult

public final class PushResult extends Object

What the push service answered to one CloudPush send.

Accepted means ADMITTED: the service has queued the message durably and will hand it to the providers, but no provider or device has seen it yet. Whether it arrived is reported later, through delivery feedback.

A refusal is a result too, not an exception: getStatus() says which kind (400 for a bad request, 401 for a missing or wrong key, 402 when the account doesn't include the capability, 429 when the caller should slow down) and getError() carries the service's explanation.

  • Constructor Details

    • PushResult

      public PushResult(int status, List<String> deliveryIds, String error, int retryAfterSeconds)
      A result, mostly for tests of code that sends; CloudPush makes the real ones.
      Parameters:
      status - the HTTP status
      deliveryIds - the delivery ids, or null for none
      error - the service's error text, or null
      retryAfterSeconds - the seconds to wait before retrying, or -1
  • Method Details

    • getStatus

      public int getStatus()
      Returns:
      the HTTP status the service answered with
    • isAccepted

      public boolean isAccepted()
      Returns:
      true when the service admitted the message (202, or any 2xx)
    • getDeliveryIds

      public List<String> getDeliveryIds()
      One id per target the service admitted, for matching delivery feedback later.
      Returns:
      the ids, empty when there are none; never null
    • getError

      public String getError()
      Returns:
      the service's explanation of a refusal, or null when it was accepted
    • getRetryAfterSeconds

      public int getRetryAfterSeconds()
      How long a 429 asked the caller to wait.
      Returns:
      seconds from the Retry-After header, or -1 when there was none
    • toString

      public String toString()
      Description copied from class: Object
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
      Overrides:
      toString in class Object