415 Unsupported Media Type from Ajax post

I have a simple form with three fields. I need to submit it with Ajax (to a service that returns JSON) but I get 415 Unsupported Media Type. The form works just fine when it does not use Ajax. The POST comes out like this:
but shouldn’t it look like this:
{name: ‘Michael’, email: ‘[email protected]’, message: ‘test’} ?

The service exports.post does not run.

There is no clue in the log that there was any problem, but the response in Firebug has this: Could not find message body reader for type: class javax.ws.rs.core.Form of content type: application/json;charset=UTF-8 (javax.ws.rs.NotSupportedException)

I think there is a missing RESTEasy jar file “resteasy-multipart-provider.jar” see here http://www.mkyong.com/webservices/jax-rs/resteasy-could-not-find-message-body-reader-for-type-multipartform-data/

1 Like


Right now we do not support posting of requests with a body (json, multipart, etc). It’s a limitation that we want to fix as soon as possible. I am afraid that it’s not as easy as adding the resteasy-multipat-provider.jar. It’s more about how to dispatch the right requests down to your javascript controller. This will hopefully work in 6.0.


What do you recommend for posting json data to services then? Url encoding json as a parameter?

I guess that would work… might be a size limit though.