Commit Graph

14848 Commits

Author SHA1 Message Date
Stéphane Nicoll
7efa0db1d1 Merge pull request #1436 from wilkinsona/patch-2
Correct the javadoc for ExchangeResult.getUrl()
2017-05-27 09:01:54 +02:00
Sebastien Deleuze
87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Rossen Stoyanchev
2d37c966b2 Support for decoding @RequestPart content
Issue: SPR-15515
2017-05-26 18:03:01 -04:00
Andy Wilkinson
bc2e1b375e Correct the javadoc for ExchangeResult.getUrl() 2017-05-26 20:58:53 +01:00
Rossen Stoyanchev
be0b671191 Upgrade nio-multipart-parser to 1.1.0
Issue: SPR-15515
2017-05-26 09:19:10 -04:00
Juergen Hoeller
e7b41bc30a Use Apache Johnzon 1.1 for JSON-B integration tests
Issue: SPR-15590
2017-05-25 23:37:14 +02:00
Juergen Hoeller
3cc94ae8b5 Consistently accept "taskExecutor" bean of type Executor (as stated in @EnableAsync's javadoc)
Issue: SPR-15566
2017-05-25 23:37:02 +02:00
Rossen Stoyanchev
0287a74d69 ExchangeResult exposes URI template used if any
Issue: SPR-15589
2017-05-25 17:07:50 -04:00
Rossen Stoyanchev
fd51893a44 Refactor exchange mutator
As a follow-up to the recent commit 246e72 some slight modifications
to MockServerExchangeMutator (renamed to ExchnageMutatorWebFilter).

Aside from the name change, the main difference is that "per request"
exchange processors are now simply applied via WebTestClient#filter(..).

Issue: SPR-15570
2017-05-25 11:41:28 -04:00
Juergen Hoeller
6fcf3a104f SharedEntityManagerCreator detects JPA 2.2's getResultStream method as query-terminating
This commit also changes "hibval5Version" to the more general "hibvalVersion" build variable, and includes dependency updates to Caffeine 2.5.1 and JRuby 9.1.9.

Issue: SPR-13482
2017-05-25 13:16:51 +02:00
Rossen Stoyanchev
346d5d2fab Refactor WebTestClient consumeWith methods
Issue: SPR-15587
2017-05-24 20:24:54 -04:00
Rossen Stoyanchev
718162b8c4 Fix issue with "redirect:" when a media type is present
Issue: SPR-15291
2017-05-24 16:31:05 -04:00
Andy Clement
109746a03b Adjust source in test class to work around eclipse compiler bug
Issue: SPR-15586
2017-05-24 13:24:24 -07:00
Rossen Stoyanchev
805fcc6a05 ResponseErrorHandler provides access to URI and method
Issue: SPR-15511
2017-05-24 15:34:40 -04:00
Rossen Stoyanchev
9b53b86d24 Check Reactor presence after Undertow for WebSocket
Issue: SPR-15539
2017-05-24 15:05:59 -04:00
Rossen Stoyanchev
df8412bded ExceptoinWebSocketHandlerDecorator uses ERROR level
Issue: SPR-15537
2017-05-24 15:00:12 -04:00
Rossen Stoyanchev
204a9cf056 Public constant for webtestclient-request-id header
Issue: SPR-15575
2017-05-24 14:26:52 -04:00
Rossen Stoyanchev
4d4c3d5c0b Replace bindToHttpHandler with bindToWebHandler
This commit replaces the option to bind the WebTestClient to an
HttpHandler to bind to a WebHandler instead.

This allows testing below the WebFlux level such as WebFilter,
WebHandler, or WebSession scenarios, but still a level above
HttpHandler so that WebTestClient is in charge of creating the
ServerWebExchange and expose consistently the
WebTestClient#MockServerSpec setup across all "mock" server bindToXxx
options.

Issue: SPR-15570
2017-05-24 14:03:57 -04:00
Rossen Stoyanchev
246e72ff2f Refactor WebTestClient exchange mutator support
This commit factors ServerWebExchange mutator support out of
WebTestClient in favor of an independent public class called
MockServerExchangeMutator which implements WebFilter and can be
applied to the WebTestClient as any other WebFilter.

The MockServerExchangeMutator also exposes a method to apply
a client-side filter for "per request" mutators. See the Javadoc
of the MockServerExchangeMutator.

Issue: SPR-15570
2017-05-24 14:03:57 -04:00
Arjen Poutsma
a5b94f3a77 Use HttpRequest.getMethodValue
This commit uses the newly introduced HttpRequest.getMethodValue in
the webflux module.

Issue: SPR-15545
2017-05-24 17:19:43 +02:00
Arjen Poutsma
630fc194f0 Add HttpRequest.getMethodValue
This commit introduces a new method in HttpRequest:
`String getMethodValue`, which returns the HTTP method as a String.
Furthermore, HttpRequest.getMethod() has been given a default
implementation using this String value in combination with
`HttpMethod.resolve`.

Issue: SPR-15545
2017-05-24 16:36:58 +02:00
Arjen Poutsma
31d1e26c95 Use List<T> instead of Supplier<Stream<T>>
This commit changes all methods that return `Supplier<Stream<T>` to
return `List<T>` instead. This includes the HandlerStrategies, but also
BodyInserter.Context, BodyExtractor.Context, and ServerResponse.Context.

The reason for this change is that most of the strategies have some sort
of order, where more specific message readers - for instance - come
before generic ones. Such an ordering can only be enforced through a
List.

Issue: SPR-15578
2017-05-24 13:48:03 +02:00
Arjen Poutsma
01e3561db9 Support RouterFunction in @EnableWebFlux
This commit removes the RouterFunctions.toHandlerMapping method, in
favor of native support for RouterFunctions in @EnableWebFlux
configuration classes.

In order to accomplish this, the HandlerStrategies components has been
repurposed to only be used for the "bare-bones" HttpHandler, while the
(newly introduced) RouterFunctionMapping uses the strategies as exposed
through WebFluxConfigurationSupport.

Furthermore, this commit also introduces support for testing
RouterFunctions without resorting to an application context.

Issue: SPR-15536
2017-05-24 11:42:15 +02:00
skarafaz
3d290165fb Find exact matches in WebJarsResourceResolver
Prior to this commit, resolving resources from webjars using the
`WebJarAssetLocator.getFullPath` could lead to multiple candidates,
since this method is trying to find *any* resource matching that path
under the given webjar location.

This commit replaces that call with
`WebJarAssetLocator.getFullPathExact`, which avoids those multiple
matches and only resolves resources if the given path is exact.

Issue: SPR-15526
(cherry picked from commit e2aa117ff9)
2017-05-24 10:46:35 +02:00
Rossen Stoyanchev
3f32f72bfc Polish
SPR-15576
2017-05-23 21:57:34 -04:00
Juergen Hoeller
0183576215 Polishing 2017-05-23 22:05:22 +02:00
Juergen Hoeller
db69a082d9 Avoid java.util.Optional signatures for simple field access
Issue: SPR-15576
2017-05-23 22:05:15 +02:00
Juergen Hoeller
ce5e2b94c4 ProtobufJsonFormatHttpMessageConverter for configurable JSON processing
Issue: SPR-15550
2017-05-23 21:59:23 +02:00
Juergen Hoeller
113f0fb13f Javadoc suggests Jackson 2.9
Issue: SPR-14925
2017-05-23 21:59:16 +02:00
Rossen Stoyanchev
b6e252495a Protect against NPE in DefaultSubscriptionRegistry
Follow-up fix on the recent commit:
https://github.com/spring-projects/spring-framework/commit/44c31a

Issue: SPR-15543
2017-05-22 16:08:34 -04:00
Stephane Nicoll
b64de87a6b Merge pull request #1411 from andreykaipov:patch-2
* pr/1411:
  Minor typo fix: form -> from
2017-05-20 14:50:18 +02:00
Andrey Kaipov
9c226aa742 Minor typo fix: form -> from
Closes gh-1411
2017-05-20 14:49:54 +02:00
Rossen Stoyanchev
11075f12bc Fix URI parsing in Reactor Netty request
Issue: SPR-15560
2017-05-19 21:47:27 -04:00
Juergen Hoeller
c59e192b0f Upgrade to Kotlin 1.1.2-4 (and Undertow 1.4.15) 2017-05-19 23:23:11 +02:00
Rossen Stoyanchev
34f1712d59 Merge pull request #1422 from svorcmar/SPR-15505 2017-05-19 17:00:16 -04:00
Rossen Stoyanchev
48a5938cd4 Polish 2017-05-19 16:59:36 -04:00
Martin Švorc
bf83e4e861 Use original query string of forwarded request
Prior to this commit, the AbstractFlashMapManager has used the
originating URI but the query string of the forwarded request. That
resulted to FlashMap not being matched even when both originating
URI and query string matched the FlashMap attributes. The originating
query string is now used to match the forwarded request.

Issue: SPR-15505
2017-05-19 16:49:29 -04:00
Bao Tran
44c31a6aad Fix duplicate STOMP subscription id issue
Issue: SPR-15543
2017-05-19 15:20:14 -04:00
Juergen Hoeller
cb3d1befcd LocalValidatorFactoryBean properly supports unwrap at ValidatorFactory level
Also documents limitation for Bean Validation 2.0's getClockProvider() method.

Issue: SPR-15561
Issue: SPR-13482
2017-05-18 21:00:56 +02:00
Juergen Hoeller
67881a5726 Polish PathPattern parser (including package change to web.util.pattern)
Issue: SPR-15531
2017-05-17 17:40:25 +02:00
Juergen Hoeller
eaac348c05 Close InputStreams in writeResourceRegionCollection (analogous to writeResourceRegion)
Issue: SPR-15559
2017-05-17 14:34:50 +02:00
Juergen Hoeller
7b3f5fd855 ResourceUtils.extractArchiveURL properly deals with top-level war URLs
Issue: SPR-15556
2017-05-17 14:22:43 +02:00
Juergen Hoeller
e835f4d025 Revised png and jpeg mappings
Issue: SPR-15546
Issue: SPR-15557
2017-05-17 14:21:44 +02:00
Arjen Poutsma
ba39697f2e Expose Principal in ServerRequest
This commit exposes the Principal in ServerRequest.

Issue: SPR-15552
2017-05-16 14:50:57 +02:00
Juergen Hoeller
94efbe2687 Latest dependency updates (OkHttp 3.8, Protobuf 3.3.1, Rome 1.7.3, Tomcat 8.5.15) 2017-05-16 11:39:21 +02:00
Juergen Hoeller
9e3f4ccce9 Merge pull request #1394 from alexander-riss/keySet
Fix inefficient use of keySet operators in messaging classes

Issue: SPR-15553
2017-05-16 11:22:22 +02:00
Alexander Riss
e49a5d8424 fix inefficient use of keySet operators in messaging classes
issue: SPR-15553
2017-05-16 10:41:22 +02:00
Rossen Stoyanchev
5ac7955de9 More qualified "request-id" header in WebTestClient
Issue: SPR-15501
2017-05-15 15:52:50 -04:00
Violeta Georgieva
7f616c216b Specify the HandlerMapping#order in the websocket example
The order value has to be specified for the HandlerMapping
so that it will be ordered before the one that serves the static resource.
2017-05-12 20:45:27 +03:00
Juergen Hoeller
f985f71daf Polishing 2017-05-12 12:50:17 +02:00