19 package org.turro.push;
21 import java.io.StringWriter;
22 import javax.json.Json;
23 import javax.json.stream.JsonGenerator;
24 import org.turro.string.Strings;
25 import org.turro.elephant.context.ElephantContext;
33 private final StringWriter writer;
34 private final JsonGenerator json;
36 private String tag, primaryKey, icon, badge;
39 json.write(
"message", Strings.truncate(
message, 240));
44 json.write(
"clickTarget", target);
54 this.primaryKey = primaryKey;
70 json.write(
"tag", tag)
71 .write(
"primaryKey", primaryKey)
72 .write(
"icon", imageFolder + icon)
73 .write(
"badge", imageFolder + badge)
76 return writer.toString();
86 icon =
"iconPush.png";
87 badge =
"badgePush.png";
88 writer =
new StringWriter();
89 json = Json.createGenerator(writer);
90 json.writeStartObject().write(
"title", Strings.truncate(
title, 65));
static String getRootWebPath()
PushMessage icon(String icon)
static PushMessage title(String title)
PushMessage tag(String tag)
PushMessage click(String target)
PushMessage badge(String badge)
PushMessage message(String message)
PushMessage primaryKey(String primaryKey)