return ((RawBuffer) body).asBytes(); } else if (body instanceof JsonNode) { return ByteString.fromString(Json.stringify((JsonNode) body)); } else if (body instanceof Document) { return XML.toBytes((Document) body);
return ((RawBuffer) body).asBytes(); } else if (body instanceof JsonNode) { return ByteString.fromString(Json.stringify((JsonNode) body)); } else if (body instanceof Document) { return XML.toBytes((Document) body);
return ((RawBuffer) body).asBytes(); } else if (body instanceof JsonNode) { return ByteString.fromString(Json.stringify((JsonNode) body)); } else if (body instanceof Document) { return XML.toBytes((Document) body);
@Override public String body() { return padding + "(" + Json.stringify(json) + ");"; }
@Override public String body() { return padding + "(" + Json.stringify(json) + ");"; }
@Override public String body() { return padding + "(" + Json.stringify(json) + ");"; }
@Override public String body() { return padding + "(" + Json.stringify(json) + ");"; }
/** * @param json Json value to use * @return An event with a string representation of {@code json} as content */ public static Event event(JsonNode json) { return new Event(Json.stringify(json), null, null); }
/** * @param json Json value to use * @return An event with a string representation of {@code json} as content */ public static Event event(JsonNode json) { return new Event(Json.stringify(json), null, null); }
/** * Send a Json message on this socket (will be received as Json in the Javascript callback method). */ public void sendMessage(JsonNode message) { out.write("<script type=\"text/javascript\">" + callbackMethod + "(" + Json.stringify(message) + ");</script>"); }
/** * @param json Json value to use * @return An event with a string representation of {@code json} as content */ public static Event event(JsonNode json) { return new Event(Json.stringify(json), null, null); }
/** * @param json Json value to use * @return An event with a string representation of {@code json} as content */ public static Event event(JsonNode json) { return new Event(Json.stringify(json), null, null); }
/** * Send a Json message on this socket (will be received as Json in the Javascript callback method). */ public void sendMessage(JsonNode message) { out.write("<script type=\"text/javascript\">" + callbackMethod + "(" + Json.stringify(message) + ");</script>"); }
/** * {@inheritDoc} */ @Override public <U> void overwriteObjectByKey(final String key, final U object) { final JsonNode jsonNode = Json.toJson(object); final String valueAsJson = Json.stringify(jsonNode); overwriteValueByKey(key, valueAsJson); }
@Override public DynamicForm bind(Lang lang, TypedMap attrs, JsonNode data, String... allowedFields) { return bind(lang, attrs, play.libs.Scala.asJava( play.api.data.FormUtils.fromJson("", play.api.libs.json.Json.parse( play.libs.Json.stringify(data) ) ) ), allowedFields ); }
@Override public DynamicForm bind(Lang lang, TypedMap attrs, JsonNode data, String... allowedFields) { return bind(lang, attrs, play.libs.Scala.asJava( play.api.data.FormUtils.fromJson("", play.api.libs.json.Json.parse( play.libs.Json.stringify(data) ) ) ), allowedFields ); }
/** * Produces a flow of ByteString using `Json.stringify` from a Flow of JsonNode. Calls * out to Comet.flow internally. * * @param callbackName the javascript callback method. * @return a flow of ByteString elements. */ public static Flow<JsonNode, ByteString, NotUsed> json(String callbackName) { return Flow.of(JsonNode.class).map(json -> { return ByteString.fromString(Json.stringify(json)); }).via(flow(callbackName)); }
/** * Produces a flow of ByteString using `Json.stringify` from a Flow of JsonNode. Calls * out to Comet.flow internally. * * @param callbackName the javascript callback method. * @return a flow of ByteString elements. */ public static Flow<JsonNode, ByteString, NotUsed> json(String callbackName) { return Flow.of(JsonNode.class).map(json -> { return ByteString.fromString(Json.stringify(json)); }).via(flow(callbackName)); }
/** * Produces a flow of ByteString using `Json.stringify` from a Flow of JsonNode. Calls * out to Comet.flow internally. * * @param callbackName the javascript callback method. * @return a flow of ByteString elements. */ public static Flow<JsonNode, ByteString, NotUsed> json(String callbackName) { return Flow.of(JsonNode.class).map(json -> { return ByteString.fromString(Json.stringify(json)); }).via(flow(callbackName)); }
private Promise<Response> executeJson(String method, JsonNode body) { WSRequest req = new WSRequest(method).setBody(Json.stringify(body)) .setUrl(url) .setHeaders(headers) .setHeader(HttpHeaders.Names.CONTENT_TYPE, "application/json; charset=utf-8") .setQueryParameters(new FluentStringsMap(queryParameters)) .setBodyEncoding("utf-8"); return execute(req); }