SpringRestTemplate-将实体放置到服务器

SpringRestTemplate-将实体放置到服务器,第1张

Spring / RestTemplate-将实体放置到服务器

您可以尝试类似:

    final String url = String.format("%s/api/shop/{id}", Global.webserviceUrl);    RestTemplate restTemplate = new RestTemplate();    restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());    HttpHeaders headers = new HttpHeaders();    headers.set("X-TP-DeviceID", Global.deviceID);    Shop shop= new Shop();    Map<String, String> param = new HashMap<String, String>();    param.put("id","10")    HttpEntity<Shop> requestEntity = new HttpEntity<Shop>(shop, headers);    HttpEntity<Shop[]> response = restTemplate.exchange(url, HttpMethod.PUT, requestEntity, Shop[].class, param);    shops = response.getBody();

认沽权无效,而交易所会给您答复,最好的检查地点是文档https://docs.spring.io/spring/docs/current/javadoc-
api/org/springframework/web/client/RestTemplate。
html



欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5032893.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存