public class Jsonp extends Object implements play.twirl.api.Content
GET /my-service Application.myService(callback: String)The following action definition:
public static Result myService(String callback) { JsonNode json = ... return ok(jsonp(callback, json)); }And the following request:
GET /my-service?callback=fooThe response will have content type "application/javascript" and will look like the following:
foo({...});
Constructor and Description |
---|
Jsonp(String padding,
com.fasterxml.jackson.databind.JsonNode json) |
Modifier and Type | Method and Description |
---|---|
String |
body() |
String |
contentType() |
static Jsonp |
jsonp(String padding,
com.fasterxml.jackson.databind.JsonNode json) |