我已经设置了我的请求的内容类型,并且仍然收到不受支持的媒体类型异常。寻找第二组在这里的眼睛....415不支持的媒体类型。内容类型集
我的Java代码:
@Path("/myPath")
public class MyResource {
SensorStore dataStore = new SensorStoreDynamoImpl();
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}")
public Reading getObj(String id) {
return dataStore.getValue(id);
}
@POST
@Consumes(MediaType.APPLICATION_JSON)
public void saveObj(String id, Double myDouble, Long myLong) {
dataStore.saveReading(id, myDouble, myLong);
}
}
呼叫我做:
POST to /myPath
Header:
Content-Type: application/json
Body:
{
id:"test",
myDouble:22.2,
myLong:22
}
任何想法?
我有同样的问题,我改变媒体类型Text_Plain则工作 – Parvathy 2013-02-13 05:10:02