Commit Graph

1069 Commits

Author SHA1 Message Date
Rossen Stoyanchev
c062835702 Respect ModelAndView.status in @ExceptionHandler
Issue: SPR-14006
2016-10-24 16:36:44 +01:00
Juergen Hoeller
9de28d640e Polishing
(cherry picked from commit 3726c6f)
2016-10-21 12:59:59 +02:00
Sebastien Deleuze
6731e52280 Better encapsulation for CORS default permit configuration
This commit also improves CorsRegistration Javadoc.

Issue: SPR-14798
2016-10-20 17:06:12 +02:00
Rossen Stoyanchev
970358b2af Relax generic type detection for ResponseEntity
Before this change the getHttpEntityType method in
HttpEntityMethodProcessor raised an ISE if the generic type cannot be
detected. That made sense for resolving a controller method argument
where the target body type is crucial. However for a return value
the generic type should not be required since we either have an
actual body or no body at all in which case it doesn't even matter.

This change relaxes the checks and defaults to Object.class for the
ResponseEntity generic type on the return value side.

Issue: SPR-14799
2016-10-13 13:59:13 -04:00
Brian Clozel
c98cdd4f4c Fix missing ETag/LastModified headers in responses
Prior to this commit, the `HttpEntityMethodProcessor` would avoid
writing ETag/Last-Modified response headers before calling
`ServletWebRequest` to process conditional requests. This was done to
avoid duplicate response header values due to headers being already
written to the underlying servlet response.

This is still necessary for GET/HEAD requests, since this is properly
handled by `ServletWebRequest` for those cases. But
`HttpEntityMethodProcessor` should not make that decision for
PUT/PATCH/POST responses since developers are adding response headers on
purpose and should be in control of the situation — whereas
`ServletWebRequest` does not write those headers in those cases.

Issue: SPR-14767
Cherry-picked from: ee17f5662
2016-10-04 13:54:02 +02:00
Juergen Hoeller
ca17edd5ac Revised checkResource implementation
Issue: SPR-14729
2016-09-18 21:04:37 +02:00
Sam Brannen
15d3e8c3e1 Introduce 'value' alias for @Bean's 'name' attribute
In order to simplify configuration for use cases involving @Bean where
only a bean name or aliases are supplied as an attribute, this commit
introduces a new 'value' attribute that is an @AliasFor 'name' in @Bean.

Issue: SPR-14728
(cherry picked from commit 8f62b63)
2016-09-18 21:04:25 +02:00
Brian Clozel
66b370e103 Check template availability in ScriptTemplateView
This commit overrides the `checkResource` implementation in
`ScriptTemplateView` in order to check if the template file resource is
available and if the resolver can then proceed with rendering the
template.

Issue: SPR-14729
Cherry-picked from: 97c9b05c15
2016-09-17 22:30:29 +02:00
Juergen Hoeller
e947363a11 Timeout exceptions as RuntimeExceptions
Issue: SPR-14669
(cherry picked from commit 6dc1898)
2016-09-15 09:05:14 +02:00
Rossen Stoyanchev
5dbfe48d24 Improve async request timeout handling
Rather than setting the status to 503 directly from the timeout
interceptor which no longer seems to work reliably with Servlet
containers like Jetty even performing an additional ERROR dispatch back
to the original URL, we know rather set the DeferredResult to an
AsyncTimeoutException, which results in a dispatch and standard
handling within Spring MVC. This should be a more reliable way of
dealing with timeouts.

Issue: SPR-14669
2016-09-14 21:31:30 -04:00
Juergen Hoeller
040d131284 Polishing
(cherry picked from commit ce42ed4)
2016-09-13 22:31:47 +02:00
Brian Clozel
6501bc5d32 Align MVC checkNotModified with reactive support
Since SPR-14522, the web reactive framework supports checkNotModified
features. This commit aligns the existing MVC infrastructure with
web reactive's behavior.

Code duplication has been removed from `HttpEntityMethodProcessor`
but the Servlet 2.5 baseline is still respected.

Issue: SPR-14659
Cherry-picked from: cc5300c4d5
2016-09-06 18:17:47 +02:00
Brian Clozel
f3dae0c9ad Mention AntPathMatcher regexp support
This commit documents the regexp support in `AntPathMatcher` when
matching for URL patterns. This support is also mentioned in places
where developers can register patterns for ViewControllers or resource
handlers.

Issue: SPR-14652
Cherry-picked from: a8ba065a6e
2016-09-02 11:40:11 +02:00
Juergen Hoeller
c30290b43c @PathVariable supports 'required' attribute (for model attribute methods)
Issue: SPR-14646
(cherry picked from commit e08b1b7)
2016-08-31 14:57:21 +02:00
Brian Clozel
d26421fe3b Fix missing ResourceHttpRequestHandler init in registry
Issue: SPR-14577
Cherry-picked from: 7a88776329
2016-08-31 10:47:18 +02:00
Rossen Stoyanchev
815a3ad0de Relax ServletContext check for resource handling
This is a follow-up on commit fe4046 relaxing the expectation that a
ServletContext is present. Instead we check defensively and fall back
on PathExtensionContentNegotiationStrategy which can use JAF.

Issue: SPR-14577
2016-08-30 12:57:35 -04:00
Rossen Stoyanchev
ca09dcbe89 Polish media type change in ResourceHttpRequestHandler 2016-08-29 19:48:06 -04:00
Rossen Stoyanchev
fe404628e9 Fix media type regression in resource handling
Issue: SPR-14577
2016-08-29 16:39:07 -04:00
Juergen Hoeller
430180aa96 Polishing 2016-08-26 18:33:13 +02:00
Juergen Hoeller
e828be96f0 Polishing 2016-08-26 17:29:16 +02:00
Brian Clozel
798d8668a4 Fix server errors for invalid If-None-Match request headers
HttpEntityMethodProcessor should not throw IllegalArgumentExceptions for
invalid If-None-Match headers.

For those cases, this commit makes sure that both
`HttpEntityMethodProcessor` and `ServletWebRequest` have a consistent
behavior and stop processing the request as conditional and leave the
handler handle it.

Issue: SPR-14559
2016-08-26 15:33:02 +02:00
Juergen Hoeller
2a82b8fed9 Consistent use of Charset.forName over JDK 7 StandardCharsets in 4.x line 2016-08-26 13:11:39 +02:00
Juergen Hoeller
696f687419 Moved encodeHttpHeaderFieldParam method to HttpHeaders itself (including tests)
This commit also sets the test source encoding to UTF-8.

Issue: SPR-14547
(cherry picked from commit a8f7f75)
2016-08-26 12:55:34 +02:00
Juergen Hoeller
1e8065d040 Unit test for empty Access-Control-Request-Headers (Chrome 52)
Includes optimized method/header resolution in CorsConfiguration.

Issue: SPR-14617
(cherry picked from commit d047174)
2016-08-24 11:53:44 +02:00
Juergen Hoeller
5222489a01 Various @since tags (and varargs on setInterceptors)
(cherry picked from commit aac0e63)
2016-08-18 12:40:22 +02:00
Juergen Hoeller
27f830f345 Polishing 2016-08-18 10:28:31 +02:00
Juergen Hoeller
8d7db8e450 DelegatingWebMvcConfiguration properly delegates extendHandlerExceptionResolvers
Also fixes the declared visibility of configurePathMatch and configureAsyncSupport.

Issue: SPR-14599
(cherry picked from commit d2e3a1a)
2016-08-18 09:53:15 +02:00
Juergen Hoeller
c926ec477a Polishing 2016-08-17 17:47:14 +02:00
Juergen Hoeller
35e247aa26 Polishing 2016-08-10 16:21:35 +02:00
Juergen Hoeller
67ba187b6f Polishing
(cherry picked from commit 59a24b4)
2016-08-10 14:57:50 +02:00
Sebastien Deleuze
7c5050cf80 Prevent StackOverflowError in AbstractJackson2HttpMessageConverter
Issue: SPR-14520
2016-08-04 11:28:20 -07:00
Juergen Hoeller
0ef80d3579 JasperReportsMultiFormatViewTests does not check for CUSTOM_COMPILATION anymore
Issue: SPR-10423
2016-07-25 15:19:50 +02:00
Juergen Hoeller
9451177c35 Polishing
(cherry picked from commit 382a931)
2016-07-22 22:45:14 +02:00
Juergen Hoeller
5a92aa4e06 Polishing
(cherry picked from commit a39276a)
2016-07-20 23:23:30 +02:00
Juergen Hoeller
7b1010cf61 Polishing 2016-07-20 22:31:45 +02:00
Juergen Hoeller
36e1c82ef5 Backported refinements and polishing 2016-07-20 21:46:25 +02:00
Juergen Hoeller
b583aa1579 Avoid dependency on WebUtils for extracting file extension
Issue: SPR-14479
(cherry picked from commit adc595b)
2016-07-20 21:44:37 +02:00
Sebastien Deleuze
b2f0bdb0f4 Polishing
Issue: SPR-14470
2016-07-20 09:16:50 +02:00
Sebastien Deleuze
940bdd878e Fix ParameterizedType + contextClass support in Jackson converter
Issue: SPR-14470
2016-07-19 18:10:51 +02:00
Juergen Hoeller
69dd40ec89 Javadoc fixes and pruning of deprecated references 2016-07-15 22:47:05 +02:00
Juergen Hoeller
f0a826ec0c AbstractHandlerMethodMapping adds type+method info to getMappingForMethod exceptions
Issue: SPR-14452
(cherry picked from commit 8ccd727)
2016-07-15 15:38:23 +02:00
Juergen Hoeller
5c3c0f73c1 Configurable UrlPathHelper in PathExtensionContentNegotiationStrategy
This commit also aligns ResourceUrlProvider's and RequestMappingInfo's UrlPathHelper setter/getter signatures.

Issue: SPR-14454
(cherry picked from commit 84afc60)
2016-07-15 15:37:56 +02:00
Juergen Hoeller
e30429051d Polishing
(cherry picked from commit 6aa5931)
2016-07-15 15:34:27 +02:00
Juergen Hoeller
92d78c10a2 Polishing (backported from master) 2016-07-06 17:13:18 +02:00
Juergen Hoeller
b204437cef Polishing 2016-07-02 14:48:15 +02:00
Juergen Hoeller
e7a53e37fb Avoid stateful MethodParameter nesting level changes in MVC processing 2016-07-02 13:02:22 +02:00
Juergen Hoeller
cfc560c4c4 Leniently accept custom DeferredResult etc subclasses for null values
Issue: SPR-14423
2016-07-02 12:55:30 +02:00
Rossen Stoyanchev
9c29ed75f8 Suppress OPTIONS handling for an ERROR dispatch
Issue: SPR-14410
2016-06-30 12:34:54 -04:00
Juergen Hoeller
16949941f8 MatchableHandlerMapping extends HandlerMapping and lives in web.servlet.handler now
Issue: SPR-14321
2016-06-30 14:38:26 +02:00
Rossen Stoyanchev
89396ff01f Refactor handleNoMatch for @RequestMapping
Originally handleNoMatch looked for partial matches based on URL
pattern, HTTP method, consumes, produces, and params in that order
but without narrowing down the set of partial matches resulting in
potentially inaccruate response status codes

Commit 473de0 added an improvement to narrow the set with partial
matches for URL pattern and HTTP method matches.

This commit overhauls handleNoMatch so that the narrowing down of
matches happens at each stage resulting in more accurate error
reporting for request mappings with fine-grained conditions.

Issue: SPR-14397
2016-06-29 15:59:00 -04:00