Commit Graph

800 Commits

Author SHA1 Message Date
Juergen Hoeller ac4c37d8e2 Merge branch '5.1.x' 2019-03-07 18:05:46 +01:00
Juergen Hoeller 6c87ef09c1 Polishing 2019-03-07 17:55:32 +01:00
stsypanov cb4d6f097c Use StringJoiner where possible to simplify String joining 2019-03-07 16:51:18 +01:00
Juergen Hoeller 5c1776ae8f Merge branch '5.1.x' 2019-03-06 16:26:00 +01:00
Juergen Hoeller b8f29962ac Upgrade to SLF4J 1.7.26, H2 1.4.198, OkHttp 3.13.1, WebJars Locator 0.37
Includes Mockito 2.25, Undertow 2.0.19, OpenPDF 1.2.10, JRuby 9.2.6.
2019-03-06 16:24:14 +01:00
Johnny Lim 625e210676 Polish 2019-02-25 12:17:53 +01:00
Juergen Hoeller 0652e4b485 Merge branch '5.1.x' 2019-02-22 14:51:00 +01:00
Juergen Hoeller c3fa900672 Upgrade to Hibernate Validator 5.4.3 and 6.0.15 2019-02-22 14:18:08 +01:00
Brian Clozel fb66619187 Merge branch '5.1.x' 2019-02-21 17:52:17 +01:00
Brian Clozel e47f7ef7b5 Remove response content-type before error handling
Prior to this commit, the negotiated content-type during the request
mapping phase would be kept as the response content-type header; this
information is used when rendering the error response and prevents a new
round of content negotiation to choose the media type that fits best.

This commit removes the response content type information at the
beginning of the error handling phase.

Fixes gh-22452
2019-02-21 17:44:03 +01:00
Sebastien Deleuze 19f792db66 Add Coroutines support for WebClient and WebFlux.fn
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in `ReactiveAdapterRegistry`
 - Support Coroutines for WebFlux annotated controllers
 - Fix return type of Kotlin suspending functions (gh-21058)

See gh-19975
2019-02-18 09:23:31 +01:00
Sebastien Deleuze 1d866053ed Leverage RouterFunctions.Builder in RouterFunctionDsl
Closes gh-22423
2019-02-17 17:20:11 +01:00
Sebastien Deleuze 175c27657e Merge branch '5.1.x' 2019-02-17 10:39:15 +01:00
Ryan Scheidter 6e7c3f2893 Fix a typo in RouterFunctionDsl Javadoc
Closes gh-22419
2019-02-17 09:50:06 +01:00
Brian Clozel d463598c09 Defer ExchangeFilterFunction to subscription time
Prior to this commit, the `ExchangeFilterFunction` instances configured
on a `WebClient` instance would be executed as soon as the `exchange`
method would be called. This behavior is not consistent with the server
side and can confuse filter developers as they'd need to manually
`Mono.defer()` their implementations if they want to record metrics.

This commit defers all `ExchangeFilterFunction` processing at
subscription time.

Fixes gh-22375
2019-02-12 10:52:49 +01:00
Sebastien Deleuze 0b9522c84e Migrate Kotlin Mockito tests to Mockk
Closes gh-22345
2019-02-05 15:47:08 +01:00
Brian Clozel 862fa557bd Avoid java.util.stream.Stream usage in hot paths
Prior to this commit, profiling sessions would show that using
`java.util.stream.Stream` in some hot code paths creates significant
garbage.

Where streams aren't really required, this commit turns those snippets
into imperative logic  because those are likely to be called once or
multiple times per request.

Closes gh-22341
2019-02-05 12:14:51 +01:00
Juergen Hoeller 165d2511b9 Upgrade to Apache HttpClient 4.5.7 and Commons FileUpload 1.4
Includes RxJava 2.2.6, Netty 4.1.33, Undertow 2.0.17.
2019-02-05 00:46:07 +01:00
Juergen Hoeller c700ccbc00 Upgrade to Apache HttpClient 4.5.7
Includes Hibernate ORM 5.4.1 for integration tests.
2019-02-05 00:10:40 +01:00
Juergen Hoeller 85ec9b9df2 Avoid Class.getPackage() in favor of plain Class.getName() checks
Fixes #22306
2019-01-25 15:35:49 +01:00
Juergen Hoeller 493e9c1ff0 Consistent upgrade to Rome 1.12 and WebJars Locator 0.36 2019-01-24 15:18:43 +01:00
Brian Clozel d6aa589c50 Wrap DecodingException in DefaultServerRequest
Prior to this commit, Spring WebFlux function would let
`DecodingException` thrown by codecs bubble up to the web handler level.
Since this exception is not handled by default there, the response would
be turned into a HTTP 500 status.

In the annotation model, `ArgumentResolver` implementations wrap this
exception with a `ServerWebInputException`, which itself extends
`ResponseStatusException`. The latter is supported by the error handling
infrastructure as a HTTP 400 response.

This commit ensures that `DecodingException` instances are properly
wrapped in `ServerWebInputException` at the `ServerRequest` level
directly, thus supporting all setup modes ("standalone" and through the
`DispatcherHandler`).

Fixes #22290
2019-01-22 14:54:44 +01:00
Juergen Hoeller f56fa91430 Polishing 2019-01-08 17:11:34 +01:00
Juergen Hoeller d37a18ff03 Upgrade to Hibernate Validator 6.0.14 and Apache Johnzon 1.1.11
Includes OkHttp MockWebServer 3.12.1.
2019-01-08 00:50:44 +01:00
Rossen Stoyanchev 4b24bcb799 More accurate checks for presence of MediaType.ALL
Typically a straight up equals as well as Collections#contains
checks for MediaType.ALL is susceptible to the presence of
media type parameters.

This commits adds equalsTypeAndSubtype as well as an
isPresentIn(Collection<MimeType>) methods to MimeType to faciliate
with checks for MediaType.ALL.

Issue: SPR-17550
2019-01-02 14:32:50 -05:00
Rossen Stoyanchev 1cb9f2c7b2 Explicit HEAD sorted higher than implicit one
Same fix as #7cdcc1 but for WebFlux.

Issue: SPR-14182
2019-01-02 09:23:05 -05:00
Juergen Hoeller 8d1de75b60 Upgrade to WebJars Locator 0.36 and OkHttp 3.12.1
Includes JRuby 9.2.5 and Jetty Reactive HttpClient 1.0.2.
2018-12-25 13:22:17 +01:00
Brian Clozel 6361b0cb23 Write CharSequence instances to DataBuffers
Prior to this commit, one could write a `CharSequence` to an existing
`DataBuffer` instance by turning it into a byte array or `ByteBuffer`
first. This had the following disadvantages:

1. Memory allocation was not efficient (not leveraging pooled memory
when available)
2. Dealing with `CharsetEncoder` is not always easy
3. `DataBuffer` implementations, like `NettyDataBuffer` can use
optimized implementations in some cases

This commit adds a new `DataBuffer#write(CharSequence, Charset)` method
for those cases and also an `ensureCapacity` method useful for checking
that the current buffer has enough capacity to write to it..

Issue: SPR-17558
2018-12-20 21:33:33 +01:00
Juergen Hoeller 0e8ed5931d Revised backport version 5.0.11
Issue: SPR-17410
Issue: SPR-17433
2018-12-17 18:19:21 +01:00
Juergen Hoeller a240cfcf2f Consistent support for if-(un)modified-since as ZonedDateTime/Instant
Includes DefaultRequestBodyUriSpec pre-resolving URI for HttpRequest.

Issue: SPR-17571
2018-12-17 16:21:39 +01:00
Rossen Stoyanchev 8eef97da33 HTTP header adapters print header values
Issue: SPR-17546
2018-12-12 11:40:33 -05:00
Arjen Poutsma 058608021e Fix invalid String representation for composed RequestPredicates
Issue: SPR-17594
2018-12-12 15:33:33 +01:00
Juergen Hoeller 5bbbc82e19 Consistent handling of null header values in HttpHeaders
Issue: SPR-17588
2018-12-12 11:16:45 +01:00
Kamil Szymanski 894044cea0 Optimize ResourceUrlProvider
Closes gh-2008
2018-12-11 12:12:15 +01:00
Arjen Poutsma f15bd88211 Fix checkstyle 2018-12-07 15:06:56 +01:00
Arjen Poutsma 3258ac1ec4 Expose request in WebClientResponseException
This commit exposes the request that lead to it in
WebClientResponseException, as a HttpRequest object.

Issue: SPR-17087
2018-12-07 11:08:02 +01:00
Juergen Hoeller 6a012147c4 Consistent support for last-modified argument as Instant/ZonedDateTime
Issue: SPR-17571
2018-12-06 15:53:47 +01:00
Rossen Stoyanchev 7a5f8e03bc Refine check for multiple subscribers
Commit #c187cb2 introduced proactive rejection of multiple subscribers
in ReactorClientHttpResponse, instead of hanging indefinitely as per
https://github.com/reactor/reactor-netty/issues/503.

However FluxReceive also rejects subsequent subscribers if the response
is consumed fully, as opposed to being canceled, e.g. as with
bodyToMono(Void.class). In that case, a subsequent subscriber causes
two competing error signals to be sent, and one gets dropped and
logged by reactor-core.

This fix ensures that a rejection is raised in
ReactorClientHttpResponse only after a cancel() was detected.

Issue: SPR-17564
2018-12-04 21:27:37 -05:00
Juergen Hoeller 77ab88b144 Polishing 2018-11-23 13:56:02 +01:00
Juergen Hoeller ae8f680d2e Polishing 2018-11-22 18:21:56 +01:00
Juergen Hoeller bf272b0b21 Nullability fine-tuning based on IntelliJ IDEA 2018.3 inspection
Issue: SPR-15540
2018-11-22 16:12:38 +01:00
Juergen Hoeller b1b28d4641 ToStringVisitor consistently returns platform-independent line breaks
Issue: SPR-17322
2018-11-22 16:11:59 +01:00
Johnny Lim 17b2b8af86 Remove an unnecessary local variable 2018-11-22 13:56:22 +01:00
Rossen Stoyanchev 548126ddd8 Consistently pass param info to ServerWebInputException
Issue: SPR-17232
2018-11-21 14:41:42 -05:00
Arjen Poutsma 88cb126511 Add RequestPredicate Visitor to WebFlux.fn
This commit introduces RequestPredicates.Visitor, an implementation of
the visitor pattern for RequestPredicates.

Issue: SPR-17322
2018-11-20 14:05:17 +01:00
Rossen Stoyanchev abf9ce8a34 Improve handling of empty response with Mono<T>
Issue: SPR-17560
2018-11-19 16:48:38 -05:00
Juergen Hoeller ce5c65c0b0 Upgrade to JAXB 2.3.1, Groovy 2.5.4, Jetty 9.4.14, Tomcat 9.0.13
Includes JAX-WS 2.3.1, Awaitility 3.1.3, OkHttp 3.12, Woodstox 5.2.
2018-11-19 12:41:26 +01:00
Hanope bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
HeemangHan 729ce4108d Correct typos (#2018) 2018-11-17 16:31:01 +01:00
Rossen Stoyanchev c89e6c616a Improve logging of request mapping information
Issue: SPR-17450
2018-11-16 17:30:18 -05:00