Spring REST Concepts: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 3: | Line 3: | ||
* [[Spring_MVC_Concepts#REST|Spring MVC Concepts]] | * [[Spring_MVC_Concepts#REST|Spring MVC Concepts]] | ||
* [[Spring_Framework#Spring_Framework_Core_Technologies_Concepts|Spring Framework]] | * [[Spring_Framework#Spring_Framework_Core_Technologies_Concepts|Spring Framework]] | ||
=REST Clients= | |||
==<tt>RestTemplate</tt>== | |||
<font color=darkgray> TO PROCESS: https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#webmvc-resttemplate</font> | |||
===POSTing Resource. Data=== | |||
This overloaded version allows you to receive the newly created resource as a domain model object: | |||
<syntaxhighlight lang='java'> | |||
RestTemplate restTemplate = new RestTemplate(); | |||
MyResource model = new MyResource(...); | |||
MyResource created = restTemplate.postForObject("http://localhost:8080/myresource", model, MyResource.class); | |||
</syntaxhighlight> |
Revision as of 18:00, 12 March 2019
Internal
REST Clients
RestTemplate
TO PROCESS: https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#webmvc-resttemplate
POSTing Resource. Data
This overloaded version allows you to receive the newly created resource as a domain model object:
RestTemplate restTemplate = new RestTemplate();
MyResource model = new MyResource(...);
MyResource created = restTemplate.postForObject("http://localhost:8080/myresource", model, MyResource.class);