I have created a spring application and i am also using webservices.
I want to use jsonp callback function for which the media type should be {"application/x-javascript"}. This seems not to be working. it is returning json object and not javascript. Here is the code..
@RequestMapping(value = "widget", method = RequestMethod.GET)
@Produces({"application/x-javascript"})
public @ResponseBody JSONWithPadding displayWidgetPage(Model model, HttpServletResponse
response,HttpServletRequest request)
{
String callback = request.getParameter("callback");
PointsInfo pointsInfo =new PointsInfo();
pointsInfo.setUsername("json");
return new JSONWithPadding(pointsInfo,callback);
}
I checked using the rest client...
It says the content type is : Content-Type: application/json;charset=UTF-8
It has to be : Content-Type: application/javascript;charset=UTF-8