I'm building a service where I'm expecting json data but the call is jsonp in order to avoid cross domain issues. My annotated service looks like this:
@GET
@Path("/Person/SavePerson")
@Consumes({"application/json"})
@Produces({"application/json"})
Employee savePerson(final Person person);
The JQuery ajax call looks like this:
$.ajax({
type: "GET",
url: "http://localhost:8080/ProcureEmployee/Person/SavePerson",
data: {"First":"John", "Last": "Smith", "Address" : "XXXXXX", .....},
dataType: "jsonp",
contentType: "application/json"
});
I'm getting this error message"
[org.jboss.resteasy.core.ExceptionHandler] (default task-1) failed to execute: javax.ws.rs.NotSupportedException: Cannot consume content type
at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:380) [resteasy-jaxrs-3.0.8.Final.jar:]
............
.......
I'm using Wildfly 8.1.0 and SY 2.0.0 beta1. From what I understand, Wildfly already includes a resteasy jsonp provider/plugin that should automatically detect a jsonp request and do it's thing. I did not configure anything specific for using jsonp in my SY application. Is this the correct assumption? If anything, a sample of how I would incorporate jsonp into my SY app would be helpful. TIA.