public class Jsonp extends java.lang.Object implements 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 “text/javascript” and will look like the following:
foo({...});
Constructor and Description |
---|
Jsonp(java.lang.String padding,
org.codehaus.jackson.JsonNode json) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
body() |
java.lang.String |
contentType() |
static Jsonp |
jsonp(java.lang.String padding,
org.codehaus.jackson.JsonNode json) |
public java.lang.String body()
public java.lang.String contentType()
public static Jsonp jsonp(java.lang.String padding, org.codehaus.jackson.JsonNode json)
padding
- Name of the callbackjson
- Json content