1 Reply Latest reply on Feb 5, 2015 2:48 PM by Los Morales

    RestEasy and jsonp

    Los Morales Newbie

      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.

        • 1. Re: RestEasy and jsonp
          Los Morales Newbie

          Forgot to mention that I added a jboss-deployment-structure and included it in META-INF but I get the same issue:

           

          <jboss-deployment-structure>

            <deployment>

                  <dependencies>

                      <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" annotations="true"/>

                  </dependencies>

              </deployment>

          </jboss-deployment-structure>