4371 shaares
Since Spring 4.1, it is really easy to enable JSONP on an API controller:
@RestController
@RequestMapping(value = "/")
public class MyController {
@ControllerAdvice
static class JsonpAdvice extends AbstractJsonpResponseBodyAdvice {
public JsonpAdvice() {
super("callback"); // name of the query parameter to use
}
}
@RequestMapping(value = "/", method = RequestMethod.GET)
public MyAPIResult getStuff(...) {
...
}
}
There is no RFC …