@RequestMapping: Difference between revisions
Jump to navigation
Jump to search
(→path) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
=Overview= | =Overview= | ||
General purpose request handling, that can be configured with the type of request to intercept and with the path to respond to. | General purpose request handling, that can be configured with the type of request to intercept and with the path to respond to. The HTTP method to map to is specified in the <tt>method</tt> attribute. | ||
=TODO= | =TODO= | ||
Line 12: | Line 12: | ||
@RequestMapping("/something") | @RequestMapping("/something") | ||
@RequestMapping(method=RequestMethod.GET) | @RequestMapping(method=RequestMethod.GET) | ||
@RequestMapping(path = "/a", produces = "application/json") | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=Data Members= | |||
==path== | |||
<syntaxhighlight lang='java'> | |||
@RequestMapping(path = "/a") | |||
</syntaxhighlight> | |||
==produces== | |||
<syntaxhighlight lang='java'> | |||
@RequestMapping(path = "/a", produces = "application/json") | |||
</syntaxhighlight> | |||
Specifies that the handler method annotated as such will only handle requests if the request's [[HTTP_Request_Header_Accept|Accept]] header includes the specified content type, "application/json" in this case. |
Latest revision as of 20:08, 12 March 2019
Internal
Overview
General purpose request handling, that can be configured with the type of request to intercept and with the path to respond to. The HTTP method to map to is specified in the method attribute.
TODO
@RequestMapping("/something")
@RequestMapping(method=RequestMethod.GET)
@RequestMapping(path = "/a", produces = "application/json")
Data Members
path
@RequestMapping(path = "/a")
produces
@RequestMapping(path = "/a", produces = "application/json")
Specifies that the handler method annotated as such will only handle requests if the request's Accept header includes the specified content type, "application/json" in this case.