@GetMapping: Difference between revisions
Jump to navigation
Jump to search
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Spring MVC Concepts]] | * [[Spring MVC Concepts#.40GetMapping|Spring MVC Concepts]] | ||
* [[Spring_REST_Concepts#Read_a_Resource_Representation|Spring REST Concepts]] | |||
=Overview= | =Overview= | ||
The annotation indicates that the annotated method handles GET request for the path provided as argument of the annotation. | The annotation indicates that the annotated method handles GET request for the path provided as argument of the annotation. | ||
It may also contain a sub-path relative to the class-level base path, usually configured with [[@RequestMapping]]. | |||
=REST= | |||
<syntaxhighlight lang='java'> | |||
@RestController | |||
@RequestMapping(path = "/a", produces = "application/json") | |||
public class AController { | |||
@GetMapping | |||
public Collection<A> get() { | |||
return ... | |||
} | |||
} | |||
</syntaxhighlight> | |||
==HTTP GET Semantics for REST Applications== | |||
{{Internal|REST_and_Hypermedia#GET|HTTP GET Semantics for REST Applications}} |
Latest revision as of 01:30, 13 March 2019
Internal
Overview
The annotation indicates that the annotated method handles GET request for the path provided as argument of the annotation.
It may also contain a sub-path relative to the class-level base path, usually configured with @RequestMapping.
REST
@RestController
@RequestMapping(path = "/a", produces = "application/json")
public class AController {
@GetMapping
public Collection<A> get() {
return ...
}
}