Package com.eatthepath.pushy.apns.server
Class ParsingMockApnsServerListenerAdapter
- java.lang.Object
-
- com.eatthepath.pushy.apns.server.ParsingMockApnsServerListenerAdapter
-
- All Implemented Interfaces:
MockApnsServerListener
public abstract class ParsingMockApnsServerListenerAdapter extends Object implements MockApnsServerListener
A parsing APNs server listener is an abstract base class that parses HTTP/2 headers and payload byte buffers from a mock APNs server into
ApnsPushNotification
instances for easier handling.Note that the mock server's decision to accept or reject a push notification is controlled by its
PushNotificationHandler
. As a result, notifications accepted by a mock server might be rejected by a real APNs server or vice versa. Push notifications parsed by this class may have missing, incomplete, or nonsense data regardless of whether they were accepted or rejected, and callers should use appropriate caution.- Since:
- 0.12
- See Also:
MockApnsServerBuilder.setListener(MockApnsServerListener)
-
-
Constructor Summary
Constructors Constructor Description ParsingMockApnsServerListenerAdapter()
-
Method Summary
Modifier and Type Method Description abstract void
handlePushNotificationAccepted(ApnsPushNotification pushNotification)
Handles a parsed push notification accepted by a mock server.void
handlePushNotificationAccepted(Http2Headers headers, ByteBuf payload)
Parses a push notification accepted by a mock APNs server into anApnsPushNotification
instance for further processing byhandlePushNotificationAccepted(ApnsPushNotification)
.abstract void
handlePushNotificationRejected(ApnsPushNotification pushNotification, RejectionReason rejectionReason, Date deviceTokenExpirationTimestamp)
Handles a parsed push notification accepted by a mock server.void
handlePushNotificationRejected(Http2Headers headers, ByteBuf payload, RejectionReason rejectionReason, Date deviceTokenExpirationTimestamp)
Parses a push notification rejected by a mock APNs server into anApnsPushNotification
instance for further processing byhandlePushNotificationRejected(ApnsPushNotification, RejectionReason, Date)
.
-
-
-
Method Detail
-
handlePushNotificationAccepted
public void handlePushNotificationAccepted(Http2Headers headers, ByteBuf payload)
Parses a push notification accepted by a mock APNs server into anApnsPushNotification
instance for further processing byhandlePushNotificationAccepted(ApnsPushNotification)
.- Specified by:
handlePushNotificationAccepted
in interfaceMockApnsServerListener
- Parameters:
headers
- the notification's HTTP/2 headerspayload
- the notification's payload
-
handlePushNotificationAccepted
public abstract void handlePushNotificationAccepted(ApnsPushNotification pushNotification)
Handles a parsed push notification accepted by a mock server. Note that any field of the parsed push notification may benull
.- Parameters:
pushNotification
- the notification accepted by the server
-
handlePushNotificationRejected
public void handlePushNotificationRejected(Http2Headers headers, ByteBuf payload, RejectionReason rejectionReason, Date deviceTokenExpirationTimestamp)
Parses a push notification rejected by a mock APNs server into anApnsPushNotification
instance for further processing byhandlePushNotificationRejected(ApnsPushNotification, RejectionReason, Date)
.- Specified by:
handlePushNotificationRejected
in interfaceMockApnsServerListener
- Parameters:
headers
- the notification's HTTP/2 headerspayload
- the notification's payloadrejectionReason
- the reason the push notification was rejected by the mock serverdeviceTokenExpirationTimestamp
- the time at which the push notification's destination device token expired;
-
handlePushNotificationRejected
public abstract void handlePushNotificationRejected(ApnsPushNotification pushNotification, RejectionReason rejectionReason, Date deviceTokenExpirationTimestamp)
Handles a parsed push notification accepted by a mock server. Note that any field of the parsed push notification may benull
.- Parameters:
pushNotification
- the push notification rejected by the serverrejectionReason
- the reason the push notification was rejected by the mock serverdeviceTokenExpirationTimestamp
- the time at which the push notification's destination device token expired;
-
-