use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class LocalDateInterval method toJson.
@Override
public JsonValue toJson() {
JsonValue object = createObject();
object.put("start", startDate.toString());
object.put("end", endDate.toString());
return object;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class GeoPoint method toJson.
@Override
public JsonValue toJson() {
JsonValue object = createObject();
object.put("latitude", latitude);
object.put("longitude", longitude);
return object;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class GeoPointType method parseJsonValue.
@Override
public FieldValue parseJsonValue(JsonValue value) {
JsonValue object = (JsonValue) value;
GeoPoint point = new GeoPoint(object.get("latitude").asNumber(), object.get("longitude").asNumber());
return point;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class QuantityType method getParametersAsJson.
@Override
public JsonValue getParametersAsJson() {
JsonValue object = createObject();
object.put("units", Strings.nullToEmpty(units));
object.put("aggregation", aggregation.toString());
return object;
}
use of org.activityinfo.json.JsonValue in project activityinfo by bedatadriven.
the class ContentSecurityServlet method doPost.
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String requestJson = CharStreams.toString(new InputStreamReader(req.getInputStream(), Charsets.UTF_8));
JsonValue request = parse(requestJson);
JsonValue report = request.get("csp-report");
StringBuilder message = new StringBuilder();
if (authProvider.isAuthenticated()) {
message.append("User: ").append(authProvider.get().getEmail());
} else {
message.append("User: ").append("Not authenticated.");
}
message.append("Content-Security Violation\n");
for (Map.Entry<String, JsonValue> entry : report.entrySet()) {
message.append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
}
LOGGER.severe(message.toString());
}
Aggregations