Update reference for HTTP HEAD and OPTIONS support
Issue: SPR-13130
This commit is contained in:
parent
135738f9bf
commit
e14f42f386
|
|
@ -590,7 +590,7 @@ are relative to the `/appointments` path. The `get()` method has a further
|
||||||
requests for `appointments/new` are handled by that method.
|
requests for `appointments/new` are handled by that method.
|
||||||
|
|
||||||
The `getForDay()` method shows another usage of `@RequestMapping`: URI templates. (See
|
The `getForDay()` method shows another usage of `@RequestMapping`: URI templates. (See
|
||||||
<<mvc-ann-requestmapping-uri-templates,the next section >>).
|
<<mvc-ann-requestmapping-uri-templates>>).
|
||||||
|
|
||||||
A `@RequestMapping` on the class level is not required. Without it, all paths are simply
|
A `@RequestMapping` on the class level is not required. Without it, all paths are simply
|
||||||
absolute, and not relative. The following example from the __PetClinic__ sample
|
absolute, and not relative. The following example from the __PetClinic__ sample
|
||||||
|
|
@ -1162,6 +1162,26 @@ respectively instead. They are intended specifically for that purpose.
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|
||||||
|
[[mvc-ann-requestmapping-head-options]]
|
||||||
|
==== HTTP HEAD and HTTP OPTIONS
|
||||||
|
|
||||||
|
`@RequestMapping` methods mapped to "GET" are also implicitly mapped to "HEAD",
|
||||||
|
i.e. there is no need to have "HEAD" explicitly declared. An HTTP HEAD request
|
||||||
|
is processed as if it was an HTTP GET except instead of writing the body only
|
||||||
|
the number of bytes are counted and the "Content-Length" header set.
|
||||||
|
|
||||||
|
`@RequestMapping` method have built-in support for HTTP OPTIONS. By default an
|
||||||
|
HTTP OPTIONS request is handled by setting the "Allow" response header to the
|
||||||
|
HTTP methods explicitly declared on all `@RequestMapping` methods with matching
|
||||||
|
URL patterns. When no HTTP methods are explicitly declared the "Allow" header
|
||||||
|
is set to "GET,HEAD". Therefore it's highly recommended to always explicitly
|
||||||
|
declare the HTTP method(s) an `@RequestMapping` method is meant to handle.
|
||||||
|
|
||||||
|
Although not necessary an `@RequestMapping` method can be mapped to and handle
|
||||||
|
either HTTP HEAD or HTTP OPTIONS, or both.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[[mvc-ann-methods]]
|
[[mvc-ann-methods]]
|
||||||
=== Defining @RequestMapping handler methods
|
=== Defining @RequestMapping handler methods
|
||||||
|
|
|
||||||
|
|
@ -661,8 +661,9 @@ Spring 4.3 also improves the caching abstraction as follows:
|
||||||
|
|
||||||
=== Web Improvements
|
=== Web Improvements
|
||||||
|
|
||||||
|
* Built-in support for <<mvc-ann-requestmapping-head-options,HTTP HEAD and HTTP OPTIONS>>.
|
||||||
* New `@RestControllerAdvice` annotation combines `@ControllerAdvice` with `@ResponseBody`.
|
* New `@RestControllerAdvice` annotation combines `@ControllerAdvice` with `@ResponseBody`.
|
||||||
* `@ResponseStatus` can be used on a controller type is inherited for all method.
|
* `@ResponseStatus` can be used on a controller type and is inherited for all method.
|
||||||
* `AsyncRestTemplate` supports request interception.
|
* `AsyncRestTemplate` supports request interception.
|
||||||
|
|
||||||
=== WebSocket Messaging Improvements
|
=== WebSocket Messaging Improvements
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue