So i have an ajax request, the content is a JSON string.
on the server side i have the following:
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/test")
public Response test(String s) {
Gson gson = new Gson();
myBean obj = gson.fromJson(s, myBean.class);
System.out.println(obj.getTimestemp() +" " + obj.getData().getItemCountryLocaion());
return Response.ok().entity("ok").build();
}
the above code is working just find and i'm able to retrieve the data.
while trying to use the same ajax call and changing the server code to this:
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("/test")
public Response test(myBean s) {
System.out.println(s.getTimestemp() +" " + s.getData().getItemCountryLocaion());
return Response.ok().entity("ok").build();
}
I'm getting 415 status code as a response.
myBean class has @XmlRootElement
annotation.
what did i do wrong?