I am trying to create a web service that will return jsonp. At the moment, it returns json
Here is my code:
@Path("/jsonp") public class JsonpWebservice { @GET @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public JSONWithPadding readAllP(@QueryParam("jsoncallback") @DefaultValue("jsoncallback") String jsoncallback) { ToolKitBean tkBean = new ToolKitBean(); tkBean.setNegativeCount("10"); tkBean.setPositiveCount("11"); System.out.println("jsoncallback: " + jsoncallback); return new JSONWithPadding( new GenericEntity<ToolKitBean>(tkBean) {}, jsoncallback); } }
i also defines a JAXBContext qualifier. When I look at the response from this web service, I see json, not jsonp - {"negativeCount":"10","positiveCount":"11"}
Any ideas what I need to do to get jsonP back from this web service?
Thanks Damien
source share