jeudi 22 décembre 2016

Ember JsonApi with Jax-Rs content type on Posts

I am using Ember-Data clientside and Tomee7 with Jax-RS on the Server.

I would very much like use the Ember-Data's JsonAPIAdapter and adhere to the jsonAPI specifications

If I understand correctly, all HTTP communications must have the Content-Type header set to application/vnd.api+json

The Problem when I try to POST something to the Server I get a 415 Unsupported Media error

I've decorated my services like this:

@POST
@Consumes("application/vnd.api+json")
@Path("somePostEndPoint")
public Response postService (@FormParam "someData" String someData) {
        //....
}

but I am returned:

An application/x-www-form-urlencoded form request is expected but the request media type is application/vnd.api+json. Consider removing @FormParam annotations

When I make the Request outside of EmberData (with Postman) Everything works fine.

I understand the @FormParam requires Content-Type: application/x-www-form-urlencoded. Could I use something else?

It would be a shame to not get to use the JsonApiAdapter. :(

does anyone have any Ideas what I could try?

Thanks!




Aucun commentaire:

Enregistrer un commentaire