且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 RestTemplate postForLocation 获得 STRING 响应?

更新时间:2023-02-15 08:28:19

感谢其中一个答案,我找到了如何使用 postForObject 从带有 Spring 的 POST 获取响应

Thanks to one of answers i've figured out how get the response from a POST with Spring by using the postForObject

String result = restTemplate.postForObject(API_URL + "account/authenticate/?email="+ AUTH_USER +"&token="+ AUTH_PASS, null, String.class);

出于某种原因,我不能在 MAP 中使用参数,而必须将它们内嵌在 URL 中.但这对我来说很好.

For some reason i can't use arguments with MAP and have to put them inline in URL. But that's fine for me.