您好我试图使用post请求在请求正文中引入字符串和整数,这样做的最佳方法是什么? 在休息客户端中输入类似的内容,例如:
{
"name":"ExName",
"reading":"100"
}
@POST
@Path("/SetFeeds")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@JsonCreator
//public String setFeed(@PathParam("name")String name2, @QueryParam("name") String name,@Context UriInfo uriInfo,String jsonBody){
public String setFeed(String jsonBody,@Context UriInfo uriInfo){
MultivaluedMap<String,String> queryParams = uriInfo.getQueryParameters();
String query = uriInfo.getRequestUri().getQuery();
String response = queryParams.getFirst("name");
System.out.println(response);
//System.out.println(name2);
//JSONObject jsonObject = new JSONObject();
//JSONObject nodeStats = name.get(getJSONObject("name"));
// Getting the value of a attribute in a JSONObject
//String sSDR = actualObj.getString("sdr");
//FeedObjects x=new FeedObjects();
//System.out.println(x.getName());
return response;
}