Class PushResult
java.lang.Object
com.codename1.backend.push.PushResult
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 Summary
ConstructorsConstructorDescriptionPushResult(int status, List<String> deliveryIds, String error, int retryAfterSeconds) A result, mostly for tests of code that sends;CloudPushmakes the real ones. -
Method Summary
-
Constructor Details
-
PushResult
A result, mostly for tests of code that sends;CloudPushmakes the real ones.- Parameters:
status- the HTTP statusdeliveryIds- the delivery ids, or null for noneerror- the service's error text, or nullretryAfterSeconds- 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
-
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-Afterheader, or -1 when there was none
-
toString
Description copied from class:ObjectReturns 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())
-