diff --git a/src/asciidoc/web-mvc.adoc b/src/asciidoc/web-mvc.adoc index a1c83a571efed02b0f8ba847352cb099a9b11f06..b9a2e32bfe6aa013ba44dbbcbff64bcebd18b6c9 100644 --- a/src/asciidoc/web-mvc.adoc +++ b/src/asciidoc/web-mvc.adoc @@ -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. The `getForDay()` method shows another usage of `@RequestMapping`: URI templates. (See -<>). +<>). 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 @@ -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]] === Defining @RequestMapping handler methods diff --git a/src/asciidoc/whats-new.adoc b/src/asciidoc/whats-new.adoc index 079d690794182f4e20932fd057b379013862c581..505b7f284536d349650f9519fda87fe70c7f0a35 100644 --- a/src/asciidoc/whats-new.adoc +++ b/src/asciidoc/whats-new.adoc @@ -661,8 +661,9 @@ Spring 4.3 also improves the caching abstraction as follows: === Web Improvements +* Built-in support for <>. * 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. === WebSocket Messaging Improvements