|
| UserPushSubscription () |
|
| AbstractDirect () |
|
boolean | isRedirectToCurrent () |
|
void | setRedirectToCurrent (boolean redirectToCurrent) |
|
String | createFormAction () |
|
String | createPOST (String values) |
|
String | getAjaxSubmitUrl (String containerId) |
|
String | getAjaxUrl (String containerId, String values) |
|
String | getAjaxUrl (String containerId, KeyValueMap values) |
|
String | getAjaxEvalUrl (KeyValueMap values) |
|
String | createRightNowURL (String values) |
|
String | createRightNowURL (KeyValueMap values) |
|
String | createLinkTo (String link, KeyValueMap values) |
|
String | createURL () |
|
String | createURL (IConstructor constructor, String values) |
|
String | createURL (IConstructor constructor, String values, int daysValid) |
|
String | createURL (IConstructor constructor, String values, int daysValid, boolean withDomain) |
|
String | createURL (IConstructor constructor, IContact recipe, String values, int daysValid, boolean withDomain) |
|
String | createURL (IConstructor constructor, IContact recipe, KeyValueMap values, int daysValid, boolean withDomain) |
|
boolean | itsMe (String id) |
|
boolean | myTurn (HttpServletRequest request) |
|
void | execute (ServletContext context, HttpServletRequest request, HttpServletResponse response) |
|
void | execute (IConstructor constructor) |
|
◆ UserPushSubscription()
org.turro.push.UserPushSubscription.UserPushSubscription |
( |
| ) |
|
◆ doExecute()
void org.turro.push.UserPushSubscription.doExecute |
( |
IConstructor |
constructor, |
|
|
KeyValueMap |
map |
|
) |
| |
|
protected |
Reimplemented from org.turro.elephant.direct.AbstractDirect.
Definition at line 98 of file UserPushSubscription.java.
99 if(map.containsKey(
"json")) {
100 JsonReader reader = Json.createReader(
new StringReader(map.get(
"json")));
101 JsonObject subs = reader.readObject();
102 JsonObject keys = subs.getJsonObject(
"keys");
103 PushSubscription subscription =
new PushSubscription();
104 subscription.setContactId(Authentication.getIContact().getId());
105 subscription.setEndpoint(subs.getString(
"endpoint"));
106 subscription.setPrivateKey(keys.getString(
"auth"));
107 subscription.setPublicKey(keys.getString(
"p256dh"));
108 new ElephantPU().saveObject(subscription);
109 pushMessage(subscription, PushMessage.title(
"Welcome")
110 .message(
"Successfully subscribed on this device")
111 .click(ElephantContext.getServerUrl(
"http")).json());
static void pushMessage(String idContact, String payload)
◆ getIdentifier()
String org.turro.push.UserPushSubscription.getIdentifier |
( |
| ) |
|
|
protected |
◆ instance()
static PushService org.turro.push.UserPushSubscription.instance |
( |
| ) |
|
|
static |
Definition at line 132 of file UserPushSubscription.java.
133 return PUSH_SERVICE.instance(() -> {
134 Security.addProvider(
new BouncyCastleProvider());
136 return new PushService(
137 ServerKeys.publicKey(),
138 ServerKeys.privateKey(),
139 "mailto:lluis@turro.org");
140 }
catch (GeneralSecurityException ex) {
◆ pushMessage() [1/2]
static void org.turro.push.UserPushSubscription.pushMessage |
( |
PushSubscription |
pushSubscription, |
|
|
String |
payload |
|
) |
| |
|
static |
Definition at line 69 of file UserPushSubscription.java.
71 PushService pushService =
instance();
72 Subscription.Keys keys =
new Subscription.Keys(
73 pushSubscription.getPublicKey(), pushSubscription.getPrivateKey());
74 Subscription subscription =
new Subscription(pushSubscription.getEndpoint(), keys);
75 Notification notification =
new Notification(subscription, payload);
76 HttpResponse response = pushService.send(notification);
77 if(REMOVE_RESPONSES.contains(response.getCode())) {
78 removeSubscription(pushSubscription);
80 }
catch (NoSuchAlgorithmException | NoSuchProviderException | InvalidKeySpecException ex) {
82 }
catch (GeneralSecurityException | IOException | JoseException | ExecutionException | InterruptedException ex) {
static PushService instance()
◆ pushMessage() [2/2]
static void org.turro.push.UserPushSubscription.pushMessage |
( |
String |
idContact, |
|
|
String |
payload |
|
) |
| |
|
static |
The documentation for this class was generated from the following file: