Commit Graph

899 Commits

Author SHA1 Message Date
Juergen Hoeller 28039057fd Consistent naming of HandlerMethodArgumentResolver implementations
Includes combined imports of assertion methods and related polishing.

Closes #22889
2019-05-04 18:30:56 +02:00
Juergen Hoeller f0f6af2926 Merge branch '5.1.x' 2019-05-03 18:13:12 +02:00
Juergen Hoeller ea4a174583 Polishing 2019-05-03 18:10:41 +02:00
Juergen Hoeller 3d6476da46 Polishing 2019-05-03 17:29:22 +02:00
Juergen Hoeller a7949ac84a Consistent use of StringUtils.hasLength(String) vs isEmpty(Object) 2019-05-03 17:29:14 +02:00
Juergen Hoeller ec8689d1fc Merge branch '5.1.x' 2019-05-03 14:23:59 +02:00
Juergen Hoeller 84266d71e9 Polishing 2019-05-03 14:08:20 +02:00
Juergen Hoeller eaa9a78d5d Merge branch '5.1.x' 2019-05-03 00:23:57 +02:00
Juergen Hoeller 31c3b8a291 Avoid unguarded String concatenation for debug/trace logging
Closes gh-22874
2019-05-03 00:10:56 +02:00
Rossen Stoyanchev bd8d71be0e canWrite uses actual return value type if known
Closes gh-22803
2019-05-01 16:52:23 -04:00
Rossen Stoyanchev 07c9a0e1f5 Merge branch '5.1.x' 2019-05-01 04:03:21 -04:00
Rossen Stoyanchev b5327ef60f Fix regression in ProducesRequestCondition
Closes gh-22853
2019-05-01 02:59:19 -04:00
Juergen Hoeller 52657b68ea Merge branch '5.1.x' 2019-04-30 18:55:34 +02:00
Juergen Hoeller 90d4e9090c Polishing 2019-04-30 18:43:16 +02:00
Sebastien Deleuze 89454e69c3 Deprecate MediaType.APPLICATION_JSON_UTF8
This commit deprecates MediaType.APPLICATION_JSON_UTF8 and
MediaType.APPLICATION_PROBLEM_JSON_UTF8 in favor of
MediaType.APPLICATION_JSON and MediaType.APPLICATION_PROBLEM_JSON since
UTF-8 encoding is now handled correctly by most browsers
(related bug has been fixed in Chrome since September 2017).

MediaType.APPLICATION_JSON is now used as the default JSON content type.

Closes gh-22788
2019-04-30 16:11:50 +02:00
Juergen Hoeller f8dc8523da Merge branch '5.1.x' 2019-04-26 23:00:40 +02:00
Juergen Hoeller 1f473261a8 Polishing 2019-04-26 22:56:23 +02:00
Juergen Hoeller 55418b256d Merge branch '5.1.x' 2019-04-26 16:56:04 +02:00
Juergen Hoeller e5e2d2d661 Polishing (includes minor performance refinements from master) 2019-04-26 16:51:18 +02:00
Juergen Hoeller ad497c259a Merge branch '5.1.x' 2019-04-25 14:55:04 +02:00
Juergen Hoeller 42fda0ba15 Upgrade to Tomcat 9.0.19, Jetty 9.4.17, Netty 4.1.35, OkHttp 3.14.1
Includes upgrade to Hibernate ORM 5.3.10 (for branch 5.1.x)
2019-04-25 14:32:37 +02:00
Sebastien Deleuze aee2df8919 Improve WebFlux suspending handler method support
Support for suspending handler methods introduced in Spring
Framework 5.2 M1 does not detect types correctly and does not
support suspending handler methods returning Flow which is a
common use case with WebClient.

This commit fixes these issues and adds Coroutines integration
tests.

Closes gh-22820
Closes gh-22827
2019-04-23 11:32:32 +02:00
Rossen Stoyanchev de3238dbea Merge branch '5.1.x' 2019-04-16 21:08:54 -04:00
Rossen Stoyanchev 15b2fb1210 Polish
Replacing a couple of calls to Mono.fromCallable with Mono.just which
seems to work with doOnDiscard except when nested inside Flux.defer.
2019-04-16 20:52:19 -04:00
Rossen Stoyanchev 375090bb7c LeakAwareDataBuffer related fixes
Following on 3ebbfa2191 where the local
refCount was removed in favor of using the internal refCount of the
native data buffer, this commit ensures that LeakAwareDataBufferFactory
uses a PooledDataBufferFactory delegate by default.

There are also fixes for test issues with eager allocation uncovered by
these changes in StringDecoder and ResourceDecoder.
2019-04-16 20:52:19 -04:00
Sebastien Deleuze e84347554e Ignore Kotlin script templating tests
Ignore these tests for the time being since they trigger
a NoClassDefFoundError exception with Kotlin 1.3.30.
2019-04-12 11:17:19 +02:00
Rossen Stoyanchev d1f888a7a9 Empty path mapping behaves consistently
An empty path mapping in an @RequestMapping now consistently matches to
empty paths regardless of whether there are both type and method level,
annotations, or method-level only.

Closes gh-22543
2019-04-09 15:03:43 -04:00
Rossen Stoyanchev f839c1f9cd Remove warning about empty @RequestMapping path
See gh-22543
2019-04-09 15:03:43 -04:00
Sebastien Deleuze cd0b517abf Improve Kotlin documentation 2019-04-09 12:28:00 +02:00
Sam Brannen 85f05023c6 Pull WebFlux getMappingPathPatterns() implementation up in the hierarchy
This commit moves the WebFlux getMappingPathPatterns() implementation
from RequestMappingHandlerMapping to
RequestMappingInfoHandlerMapping so that subclasses of the latter no
longer need to re-implement the method.

See gh-22543
2019-04-09 10:58:04 +02:00
Sam Brannen 55b764bac3 Remove unused import
See gh-22543
2019-04-06 12:14:46 +02:00
Sam Brannen 164ee2a4e1 Polishing
See gh-22543
2019-04-06 11:25:44 +02:00
Sam Brannen 510c0c5ef7 Return Set<PathPattern> from AbstractHandlerMethodMapping.getMappingPathPatterns
This commit revises the signature of getMappingPathPatterns() in
AbstractHandlerMethodMapping to return a set of PathPatterns instead of
a set of Strings.

See gh-22543
2019-04-06 11:18:25 +02:00
Rossen Stoyanchev 02da8486a3 Merge branch '5.1.x' 2019-04-05 21:53:55 -04:00
Rossen Stoyanchev 57558a481a DataBuffer fixes in View implementations
Closes gh-22754
2019-04-05 21:42:12 -04:00
Rossen Stoyanchev 6cabb79f0f Decode resourcePath for classpath locations
Closes gh-22272
2019-04-05 16:23:33 -04:00
Sam Brannen 72027b1746 Log warning if @RequestMapping method has no explicit mapping
Commit c0b52d09f5 introduced support for
throwing an exception if a @RequestMapping handler method in a Spring
MVC controller was mapped to an empty path. This had negative side
effects for applications that intentionally mapped to an empty path,
potentially alongside a mapping to an explicit path for the same
handler method.

This commit addresses this by logging a warning (instead of throwing an
exception) if a @RequestMapping method is mapped only to empty paths.

This commit also introduces the same support for WebFlux-based
@RequestMapping handler methods.

Closes gh-22543
2019-04-05 19:55:22 +02:00
Rossen Stoyanchev e0c2a1c59d Polish
Closes gh-22705
2019-04-04 17:13:57 -04:00
Jeoffrey Haeyaert 9976783639 WebClient uri method with uriTemplate and UriBuilder
See gh-22705
2019-04-04 17:13:57 -04:00
Sebastien Deleuze a8d6ba9965 Add support for Coroutines Flow
Flow is a Kotlin Coroutines related cold asynchronous
stream of the data, that emits from zero to N (where N
can be unbounded) values and completes normally or with
an exception.

It is conceptually the Coroutines equivalent of Flux with
an extension oriented API design, easy custom operator
capabilities and some suspending methods.

This commit leverages Flow <-> Flux interoperability
to support Flow on controller handler method parameters
or return values, and also adds Flow based extensions to
WebFlux.fn. It allows to reach a point when we can consider
Spring Framework officially supports Coroutines even if some
additional work remains to be done like adding
interoperability between Reactor and Coroutines contexts.

Flow is currently an experimental API that is expected to
become final before Spring Framework 5.2 GA.

Close gh-19975
2019-04-04 19:06:32 +02:00
Juergen Hoeller 1741b6dcd9 Merge branch '5.1.x' 2019-04-04 16:12:07 +02:00
Juergen Hoeller 95232d5bf8 Upgrade to Apache HttpClient 4.5.8 and Jetty Reactive HttpClient 1.0.3 2019-04-04 16:10:16 +02:00
Sebastien Deleuze 9217f0b63e Convert CoRouterFunctionDsl indents to tabs 2019-04-04 12:14:27 +02:00
Sebastien Deleuze 2eb631aaad Avoid exposing (Co)RouterFunctionDsl#invoke
WebFlux.fn RouterFunctionDsl#invoke and CoRouterFunctionDsl#invoke
were wrongly exposed on public API and have never been designed to
be used by end users, but rather only invoked from router { } or
coRouter { } builders.

To fix that, avoiding this method being accessible from the DSL and
for the sake of consistency with WebMvc.fn RouterFunctionDsl,
Spring Framework 5.2 turns public fun invoke() method to
an internal fun build() one.

As a consequence RouterFunctionDsl and CoRouterFunctionDsl are not
open anymore, they are expected to be extended via Kotlin
extensions if needed.

Closes gh-22736
2019-04-04 12:14:27 +02:00
Sebastien Deleuze 92d5f6395e Rename awaitPrincipal to awaitPrincipalOrNull
See gh-19975
2019-04-04 12:14:27 +02:00
Rossen Stoyanchev 72119ac076 ProducesRequestCondition caches accepted media types
Closes gh-22644
2019-04-03 14:56:30 -04:00
Rossen Stoyanchev bb9fcad58a RequestCondition implementations minor refactoring
Reduce object creation by pre-computing instances that can be re-used,
and eliminating collection copying and sorting where not needed.

See gh-22644
2019-04-03 14:56:30 -04:00
Brian Clozel 47c8d1de7b Avoid calling other bean methods in web config
This commit changes the main configuration classes for Spring MVC and
Spring WebFlux to not call other bean methods when setting up the web
infrastructure. This allows configuration classes extending
`DelegatingWebFluxConfiguration` and `DelegatingWebMvcConfiguration`
to opt-in the lite-mode, as introduced in gh-22461.
2019-04-03 10:16:41 +02:00
Sebastien Deleuze d2fa5536db Use more efficient Reactor operators
Use handle/flatMapIterable instead of flatMap/flatMapMany
when possible.

Closes gh-22727
2019-04-02 15:49:59 +02:00
Sebastien Deleuze d27b5d0ab6 Improve CORS handling
This commit improves CORS support by:
 - Using CORS processing only for CORS-enabled endpoints
 - Skipping CORS processing for same-origin requests
 - Adding Vary headers for non-CORS requests

It introduces an AbstractHandlerMapping#hasCorsConfigurationSource
method in order to be able to check CORS endpoints efficiently.

Closes gh-22273
Closes gh-22496
2019-04-01 17:42:51 +02:00