|
|
|
@ -736,8 +736,8 @@ or to render a JSON response, as the following example shows: |
|
|
|
@RequestMapping(path = "/error") |
|
|
|
@RequestMapping(path = "/error") |
|
|
|
public Map<String, Object> handle(HttpServletRequest request) { |
|
|
|
public Map<String, Object> handle(HttpServletRequest request) { |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
map.put("status", request.getAttribute("javax.servlet.error.status_code")); |
|
|
|
map.put("status", request.getAttribute("jakarta.servlet.error.status_code")); |
|
|
|
map.put("reason", request.getAttribute("javax.servlet.error.message")); |
|
|
|
map.put("reason", request.getAttribute("jakarta.servlet.error.message")); |
|
|
|
return map; |
|
|
|
return map; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -751,8 +751,8 @@ or to render a JSON response, as the following example shows: |
|
|
|
@RequestMapping(path = ["/error"]) |
|
|
|
@RequestMapping(path = ["/error"]) |
|
|
|
fun handle(request: HttpServletRequest): Map<String, Any> { |
|
|
|
fun handle(request: HttpServletRequest): Map<String, Any> { |
|
|
|
val map = HashMap<String, Any>() |
|
|
|
val map = HashMap<String, Any>() |
|
|
|
map["status"] = request.getAttribute("javax.servlet.error.status_code") |
|
|
|
map["status"] = request.getAttribute("jakarta.servlet.error.status_code") |
|
|
|
map["reason"] = request.getAttribute("javax.servlet.error.message") |
|
|
|
map["reason"] = request.getAttribute("jakarta.servlet.error.message") |
|
|
|
return map |
|
|
|
return map |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1932,7 +1932,7 @@ instead. |
|
|
|
|
|
|
|
|
|
|
|
`@GetMapping` (and `@RequestMapping(method=HttpMethod.GET)`) support HTTP HEAD |
|
|
|
`@GetMapping` (and `@RequestMapping(method=HttpMethod.GET)`) support HTTP HEAD |
|
|
|
transparently for request mapping. Controller methods do not need to change. |
|
|
|
transparently for request mapping. Controller methods do not need to change. |
|
|
|
A response wrapper, applied in `javax.servlet.http.HttpServlet`, ensures a `Content-Length` |
|
|
|
A response wrapper, applied in `jakarta.servlet.http.HttpServlet`, ensures a `Content-Length` |
|
|
|
header is set to the number of bytes written (without actually writing to the response). |
|
|
|
header is set to the number of bytes written (without actually writing to the response). |
|
|
|
|
|
|
|
|
|
|
|
`@GetMapping` (and `@RequestMapping(method=HttpMethod.GET)`) are implicitly mapped to |
|
|
|
`@GetMapping` (and `@RequestMapping(method=HttpMethod.GET)`) are implicitly mapped to |
|
|
|
@ -2053,17 +2053,17 @@ and others) and is equivalent to `required=false`. |
|
|
|
| Generic access to request parameters and request and session attributes, without direct |
|
|
|
| Generic access to request parameters and request and session attributes, without direct |
|
|
|
use of the Servlet API. |
|
|
|
use of the Servlet API. |
|
|
|
|
|
|
|
|
|
|
|
| `javax.servlet.ServletRequest`, `javax.servlet.ServletResponse` |
|
|
|
| `jakarta.servlet.ServletRequest`, `jakarta.servlet.ServletResponse` |
|
|
|
| Choose any specific request or response type -- for example, `ServletRequest`, `HttpServletRequest`, |
|
|
|
| Choose any specific request or response type -- for example, `ServletRequest`, `HttpServletRequest`, |
|
|
|
or Spring's `MultipartRequest`, `MultipartHttpServletRequest`. |
|
|
|
or Spring's `MultipartRequest`, `MultipartHttpServletRequest`. |
|
|
|
|
|
|
|
|
|
|
|
| `javax.servlet.http.HttpSession` |
|
|
|
| `jakarta.servlet.http.HttpSession` |
|
|
|
| Enforces the presence of a session. As a consequence, such an argument is never `null`. |
|
|
|
| Enforces the presence of a session. As a consequence, such an argument is never `null`. |
|
|
|
Note that session access is not thread-safe. Consider setting the |
|
|
|
Note that session access is not thread-safe. Consider setting the |
|
|
|
`RequestMappingHandlerAdapter` instance's `synchronizeOnSession` flag to `true` if multiple |
|
|
|
`RequestMappingHandlerAdapter` instance's `synchronizeOnSession` flag to `true` if multiple |
|
|
|
requests are allowed to concurrently access a session. |
|
|
|
requests are allowed to concurrently access a session. |
|
|
|
|
|
|
|
|
|
|
|
| `javax.servlet.http.PushBuilder` |
|
|
|
| `jakarta.servlet.http.PushBuilder` |
|
|
|
| Servlet 4.0 push builder API for programmatic HTTP/2 resource pushes. |
|
|
|
| Servlet 4.0 push builder API for programmatic HTTP/2 resource pushes. |
|
|
|
Note that, per the Servlet specification, the injected `PushBuilder` instance can be null if the client |
|
|
|
Note that, per the Servlet specification, the injected `PushBuilder` instance can be null if the client |
|
|
|
does not support that HTTP/2 feature. |
|
|
|
does not support that HTTP/2 feature. |
|
|
|
@ -2927,7 +2927,7 @@ as the following example shows: |
|
|
|
|
|
|
|
|
|
|
|
For use cases that require adding or removing session attributes, consider injecting |
|
|
|
For use cases that require adding or removing session attributes, consider injecting |
|
|
|
`org.springframework.web.context.request.WebRequest` or |
|
|
|
`org.springframework.web.context.request.WebRequest` or |
|
|
|
`javax.servlet.http.HttpSession` into the controller method. |
|
|
|
`jakarta.servlet.http.HttpSession` into the controller method. |
|
|
|
|
|
|
|
|
|
|
|
For temporary storage of model attributes in the session as part of a controller |
|
|
|
For temporary storage of model attributes in the session as part of a controller |
|
|
|
workflow, consider using `@SessionAttributes` as described in |
|
|
|
workflow, consider using `@SessionAttributes` as described in |
|
|
|
@ -3116,7 +3116,7 @@ When the `@RequestParam` annotation is declared as a `Map<String, MultipartFile> |
|
|
|
`MultiValueMap<String, MultipartFile>`, without a parameter name specified in the annotation, |
|
|
|
`MultiValueMap<String, MultipartFile>`, without a parameter name specified in the annotation, |
|
|
|
then the map is populated with the multipart files for each given parameter name. |
|
|
|
then the map is populated with the multipart files for each given parameter name. |
|
|
|
|
|
|
|
|
|
|
|
NOTE: With Servlet 3.0 multipart parsing, you may also declare `javax.servlet.http.Part` |
|
|
|
NOTE: With Servlet 3.0 multipart parsing, you may also declare `jakarta.servlet.http.Part` |
|
|
|
instead of Spring's `MultipartFile`, as a method argument or collection value type. |
|
|
|
instead of Spring's `MultipartFile`, as a method argument or collection value type. |
|
|
|
|
|
|
|
|
|
|
|
You can also use multipart content as part of data binding to a |
|
|
|
You can also use multipart content as part of data binding to a |
|
|
|
@ -3891,11 +3891,11 @@ level, <<mvc-exceptionhandlers, HandlerExceptionResolver>> mechanism. |
|
|
|
| Generic access to request parameters and request and session attributes without direct |
|
|
|
| Generic access to request parameters and request and session attributes without direct |
|
|
|
use of the Servlet API. |
|
|
|
use of the Servlet API. |
|
|
|
|
|
|
|
|
|
|
|
| `javax.servlet.ServletRequest`, `javax.servlet.ServletResponse` |
|
|
|
| `jakarta.servlet.ServletRequest`, `jakarta.servlet.ServletResponse` |
|
|
|
| Choose any specific request or response type (for example, `ServletRequest` or |
|
|
|
| Choose any specific request or response type (for example, `ServletRequest` or |
|
|
|
`HttpServletRequest` or Spring's `MultipartRequest` or `MultipartHttpServletRequest`). |
|
|
|
`HttpServletRequest` or Spring's `MultipartRequest` or `MultipartHttpServletRequest`). |
|
|
|
|
|
|
|
|
|
|
|
| `javax.servlet.http.HttpSession` |
|
|
|
| `jakarta.servlet.http.HttpSession` |
|
|
|
| Enforces the presence of a session. As a consequence, such an argument is never `null`. + |
|
|
|
| Enforces the presence of a session. As a consequence, such an argument is never `null`. + |
|
|
|
Note that session access is not thread-safe. Consider setting the |
|
|
|
Note that session access is not thread-safe. Consider setting the |
|
|
|
`RequestMappingHandlerAdapter` instance's `synchronizeOnSession` flag to `true` if multiple |
|
|
|
`RequestMappingHandlerAdapter` instance's `synchronizeOnSession` flag to `true` if multiple |
|
|
|
@ -4768,7 +4768,7 @@ The MVC configuration also exposes several options for asynchronous requests. |
|
|
|
|
|
|
|
|
|
|
|
Filter and Servlet declarations have an `asyncSupported` flag that needs to be set to `true` |
|
|
|
Filter and Servlet declarations have an `asyncSupported` flag that needs to be set to `true` |
|
|
|
to enable asynchronous request processing. In addition, Filter mappings should be |
|
|
|
to enable asynchronous request processing. In addition, Filter mappings should be |
|
|
|
declared to handle the `ASYNC` `javax.servlet.DispatchType`. |
|
|
|
declared to handle the `ASYNC` `jakarta.servlet.DispatchType`. |
|
|
|
|
|
|
|
|
|
|
|
In Java configuration, when you use `AbstractAnnotationConfigDispatcherServletInitializer` |
|
|
|
In Java configuration, when you use `AbstractAnnotationConfigDispatcherServletInitializer` |
|
|
|
to initialize the Servlet container, this is done automatically. |
|
|
|
to initialize the Servlet container, this is done automatically. |
|
|
|
@ -6097,5 +6097,5 @@ For more details, see the |
|
|
|
https://github.com/spring-projects/spring-framework/wiki/HTTP-2-support[HTTP/2 wiki page]. |
|
|
|
https://github.com/spring-projects/spring-framework/wiki/HTTP-2-support[HTTP/2 wiki page]. |
|
|
|
|
|
|
|
|
|
|
|
The Servlet API does expose one construct related to HTTP/2. You can use the |
|
|
|
The Servlet API does expose one construct related to HTTP/2. You can use the |
|
|
|
`javax.servlet.http.PushBuilder` to proactively push resources to clients, and it |
|
|
|
`jakarta.servlet.http.PushBuilder` to proactively push resources to clients, and it |
|
|
|
is supported as a <<mvc-ann-arguments, method argument>> to `@RequestMapping` methods. |
|
|
|
is supported as a <<mvc-ann-arguments, method argument>> to `@RequestMapping` methods. |
|
|
|
|