Package play.libs
Class Jsonp
- Object
-
- play.libs.Jsonp
-
- All Implemented Interfaces:
play.twirl.api.Content
public class Jsonp extends Object implements play.twirl.api.Content
The JSONP Content renders a JavaScript call of a JSON object.
Example of use, provided the following route definition: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=foo
The response will have content type "application/javascript" and will look like the following:foo({...});
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
body()
String
contentType()
static Jsonp
jsonp(String padding, com.fasterxml.jackson.databind.JsonNode json)
-