我当前正在尝试对我的Gemfire缓存测试环境进行PUT调用 https://gemfire.docs.pivotal.io/95/geode/rest_apps/put_update_data.html
我已经尝试遵循这样的模板
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-rest/data/putdata/{id}/{name}";
Map<String, String> map = new HashMap<String, String>();
map.put("id", "100");
map.put("name", "Ram");
Address address = new Address("Dhananjaypur", "Varanasi","UP");
restTemplate.put(url, address, map);
}
在我的情况下,它看起来像什么?
RestTemplate restTemplate = new RestTemplate();
String url = "gemfire.com/gemfire-api/v1/{region}/{key};
Map<String, String> map = new HashMap<String, String>();
map.put("region", "1");
map.put("key", "testKey");
restTemplate.put(url, "testStringtoPut", map);
}
此模板对我来说导致404未找到错误, 有人可以提供有关执行此操作的正确方法的见解吗?
答案 0 :(得分:0)
尝试以这种方式进行操作,它应该可以工作
HttpEntity<String> request = new HttpEntity<String>(address.toString());
String url=http://localhost:8080/spring-rest/data/putdata/100/"Ram"
ResponseEntity <String> response= template.exchange(url,HttpMethod.PUT,request,String.class);