Commit Graph

13451 Commits

Author SHA1 Message Date
Juergen Hoeller dbaafdd04e MessageChannel declares send(Message) as default method
Issue: SPR-14854
2016-10-28 15:11:03 +02:00
Sebastien Deleuze 37ce56fe96 Upgrade to Reactor Core 3.0.3 2016-10-28 14:42:21 +02:00
Arjen Poutsma 8f844461a0 Make HttpComponentsAsyncClientHttpRequest abortable
This commit aborts the HttpComponentsAsyncClientHttpRequest whenever the
returned Future is canceled.

Issue: SPR-14845
2016-10-28 14:19:15 +02:00
Arjen Poutsma 7b469f9c62 Improve WebClient error handling
This commit introduces two new `WebClient` methods: `retrieveMono` and
`retrieveFlux`, both of which offer direct access to the response body.
More importantly, these methods publish a WebClientException if the
response status code is in the 4xx or 5xx series.

Issue: SPR-14852
2016-10-28 13:15:29 +02:00
Arjen Poutsma c96badc794 Add ExchangeFilterFunction.ofRequestProcessor and ofResponseProcessor 2016-10-28 09:05:07 +02:00
Sam Brannen c448739b7b Remove mavenLocal as a repository in Gradle build 2016-10-28 00:36:44 +02:00
Juergen Hoeller f1c20a8d31 Latest dependency updates (Hibernate ORM 5.2.4, Undertow 1.4.4, Jetty 9.4 RC1) 2016-10-27 17:42:38 +02:00
Juergen Hoeller 1b0b269370 DefaultServerResponseBuilder uses Reactor's new thenEmpty method (fixing deprecation error) 2016-10-27 17:41:33 +02:00
Sam Brannen 5c9350b8cb Support @EnabledIf & @DisabledIf w/o loading ApplicationContext
Prior to this commit, when using @EnabledIf or @DisabledIf in Spring's
JUnit Jupiter support, the test's ApplicationContext was always eagerly
loaded, even if the ApplicationContext would never be used (i.e., the
test was disabled). This behavior can lead to undesirable side effects
-- for example, attempting to load an application context that requires
services only available on the CI server when the test is not actually
running on the CI server.

This commit addresses this issue by introducing new boolean
`loadContext` flags in @EnabledIf and @DisabledIf. By default these
flags are set to false which means that the user's test application
context will not be loaded to evaluate the expression. On the contrary,
a dummy application context will be loaded instead, and expressions
will be evaluated against that dummy context. Consequently, if the user
wishes to interact with properties from the Spring Environment or with
beans from the test application context, the `loadContext` must be
explicitly set to true.

In addition, expressions which evaluate to a String must now evaluate
to exactly "true" or "false" (ignoring case and surrounding whitespace).

Issue: SPR-14649
2016-10-27 16:52:32 +02:00
Stephane Nicoll 56c48623fd Allow @Cacheable method to return Optional
This commit further refines 240f254 to also support java.util.Optional
for synchronized cache access (i.e. when the `sync` attribute on
`@Cacheable` is set to `true`).

Issue: SPR-14853
2016-10-27 09:47:15 +02:00
Stephane Nicoll ffa728c23c Move NoOpCache to a top-level public class
This commit moves `NoOpCache` to a top-level public class to allow reuse
in custom CacheManager arrangement.

Issue: SPR-14856
2016-10-27 09:06:32 +02:00
Stephane Nicoll e78af3097a Merge pull request #1225 from ejain:patch-1
* pr/1225:
  Escape (( and )) to prevent asciidoc processing
2016-10-27 08:50:04 +02:00
Eric Jain d7b68f8b91 Escape (( and )) to prevent asciidoc processing
See http://asciidoctor.org/docs/user-manual/#user-index

Closes gh-1225
2016-10-27 08:49:26 +02:00
Stephane Nicoll 1f3b8ff2f7 LiveBeansView does not rely on application contexts order anymore
This commit makes sure that the `unregister` order of registered
application contexts has no incidence on the removal of the LiveBeansView
MBean.

Rather than using the last application context's name to compute the
identity of the MBean to remove, the identity is stored when the MBean is
created.

This commit also adds missing tests.

Issue: SPR-14848
2016-10-26 15:03:14 +02:00
Stephane Nicoll 7dd3e26da4 Merge pull request #1203 from rand0m86:rand0m86-fix-beanFactory-javadoc
* pr/1203:
  Polish contribution
  Fix javadoc syntax
2016-10-26 09:50:04 +02:00
Stephane Nicoll 3a34cdba81 Polish contribution
Closes gh-1203
2016-10-26 09:49:50 +02:00
Vitalii 2980e59298 Fix javadoc syntax
See gh-1203
2016-10-26 09:46:14 +02:00
Stephane Nicoll 19db0424d2 Clarify SpEL usage on `@EventListener`
Issue: SPR-14812
2016-10-25 17:45:12 +02:00
Stephane Nicoll 7ee0abe20d Merge pull request #1222 from englishman:Int-4144_code_format_change_for_idea
* pr/1222:
  Import format fix according to Code Style
2016-10-25 17:23:02 +02:00
Andriy Kryvtsun 50a44aab54 Import format fix according to Code Style
Closes gh-1222
2016-10-25 17:22:38 +02:00
Sebastien Deleuze 2075932780 Add support for RxJava 2 Maybe type
Issue: SPR-14843
2016-10-25 16:49:22 +02:00
Arjen Poutsma 20dec61d04 Refactored BodyInserters
This commit introduces a couple of changes to BodyInserters:

- Refactored writeWithMessageWriters into BiFunction
- BodyInserters.fromResource now uses ResourceMessagewriter from context
- BodyInserters.fromServerSentEvents now uses SseHttpMessageWriter from context
2016-10-25 11:11:58 +02:00
Arjen Poutsma 94930043fd Added MediaType.TEXT_EVENT_STREAM 2016-10-25 11:11:58 +02:00
Brian Clozel 99a3210859 Refactor tests with ScriptedSubscriber
Reactor recently added the `ScriptedSubscriber` in its new
`reactor-addons` module. This `Subscriber` revissits the previous
`TestSubscriber` with many improvements, including:

* scripting each expectation
* builder API that guides you until the final verification step
* virtual time support

This commit refactor all existing tests to use this new
infrastructure and removed the `TestSubscriber` implementation.

Issue: SPR-14800
2016-10-25 10:44:44 +02:00
Stephane Nicoll 827bc78e34 Polish 2016-10-24 20:12:18 +02:00
Stephane Nicoll b7d85f8ebc Expose ResolvableType in NoSuchBeanDefinitionException
This commit improves NoSuchBeanDefinitionException to expose a full
ResolvableType rather than a raw class if a lookup by type failed. This
allows to know more about the underlying type and is typically useful
when a collection or map is required as the relevant generic type is the
actual bean that wasn't found.

Issue: SPR-14831
2016-10-24 17:43:54 +02:00
Rossen Stoyanchev efe3996cf9 Respect ModelAndView.status in @ExceptionHandler
Issue: SPR-14006
2016-10-24 16:04:49 +01:00
Rossen Stoyanchev aea3a75018 Fix failing tests
Issue: SPR-14772, SPR-14803
2016-10-21 16:19:57 -04:00
Rossen Stoyanchev 5c9c5e0b45 Early registration of WriteListener
At present Tomcat expects a WriteListener to be registered immediately
on the initial thread so for the time being this commit ensures the
WriteListener is registered unconditionally for every request.

Issue: SPR-14772, SPR-14803
2016-10-21 15:29:57 -04:00
Brian Clozel 61cf9fdda5 Remove factory methods from WebReactiveConfigurer
This commit removes factory methods for `RequestMappingHandlerMapping`
and `RequestMappingHandlerAdapter` from `WebReactiveConfigurer`.
`WebReactiveConfigurer` should promote only common customizations;
those factory methods should be overridden when extending
`WebReactiveConfigurationSupport`, in advanced configuration scenarios.
2016-10-21 21:19:32 +02:00
Rossen Stoyanchev e3673d43b9 Thread-safe reactive ServerHttpRequest
This commit replaces the lazy URI and headers initialization in the
reactive ServerHttpRequest in favor of eager initialization at
construction time. Both the URI and headers are nearly guaranteed to
be accessed for every request (URI for application path, headers for
"Origin" header).

Query params are still lazily parsed but parsing is idemptotent and
in the unlikely case of concurrent access (it's the framework that
typically accesses query params) it maybe parsed twice but should
be side effect free still.

Cookies are also parsed lazily and since we delegate to the "native"
request, it depends on the underlying runtime whether synchronization
is needed. This commit adds synchronization for the HttpServletRequest.
At present RxNetty, Reactor, and Undertow implementations provide
thread-safe access to cookies.
2016-10-21 15:17:28 -04:00
Rossen Stoyanchev 0e886abf3d Sync MockServerHttpRequest in spring-test/spring-web 2016-10-21 15:17:28 -04:00
Arjen Poutsma 08931950f4 Add byte[] encoder and decoder
This commit adds a ByteArrayDecoder and ByteArrayEncoder.
2016-10-21 12:34:06 +02:00
Juergen Hoeller 3726c6f18d Polishing 2016-10-21 12:26:27 +02:00
Juergen Hoeller be187babf9 ResolvableType equals/hashCode does not consider TypeProvider source
Issue: SPR-14826
2016-10-21 12:26:06 +02:00
Juergen Hoeller f7d740fa69 ConversionService detects generic type declaration on target class behind proxy as well
Issue: SPR-14822
2016-10-21 12:24:12 +02:00
Juergen Hoeller 52b029d71d DefaultTransactionAttribute stores descriptor (method identification)
Issue: SPR-14760
2016-10-21 12:23:13 +02:00
Juergen Hoeller 67a5ff02ac Latest dependency updates (EhCache 2.10.3, Jackson 2.8.4, Netty 4.1.6) 2016-10-21 12:16:26 +02:00
Brian Clozel 518f3fab01 Rollback to SonarQube plugin 2.1 2016-10-21 11:19:18 +02:00
Sebastien Deleuze 00ce72f9e3 Upgrade to RxJava 2.0.0-RC5 2016-10-21 10:27:48 +02:00
Rossen Stoyanchev b92d541ba0 Add contextPath support for reactive web applications
This commit introduces support for running multiple HttpHandler's under
distinct context paths which effectively allows running multiple
applications on the same server. ContextPathIntegrationTests contains
an example of two applications with different context paths.

In order to support this the HttpHandler adapters for all supported
runtimes now have a common base class HttpHandlerAdapterSupport
which has two constructor choices -- one with a single HttpHandler and
another with a Map<String, HttpHandler>.

Note that in addition to the contextPath under which an HttpHandler is
configured there may also be a "native" contextPath under which the
native runtime adapter is configured (e.g. Servlet containers). In such
cases the contextPath is a combination of the native contextPath and
the contextPath assigned to the HttpHandler. See for example
HttpHandlerAdapterSupportTests.

Issue: SPR-14726
2016-10-20 17:42:38 -04:00
Brian Clozel c2fdc9103b Upgrade SonarQube plugin version to 2.2 2016-10-20 21:45:12 +02:00
soldierkam 8143e5fe20 HttpClient instance should be shared for each call 2016-10-20 17:06:46 +02:00
Arjen Poutsma fa9cc1eb1a Add bodyToMono/bodyToFlux convenience methods
This commit adds a bodyToMono and bodyToFlux convenience method to
ClientResponse/ServerRequest, similar to the body(Publisher) method that
is on ClientRequest/ServerResponse.
2016-10-20 16:58:30 +02:00
Sebastien Deleuze 2a279b7064 Upgrade to Reactor Core 3.0.3.BUILD-SNAPSHOT 2016-10-20 16:02:37 +02:00
Sebastien Deleuze b961a31cc8 Upgrade to RxJava 1.2.1 2016-10-20 16:02:37 +02:00
Brian Clozel 31af6783a5 Update reference doc after WebClient changes
Issue: SPR-14827
2016-10-20 15:41:29 +02:00
Arjen Poutsma 59e4326989 Various improvements to web.reactive.function
This commit introduces the following changes to web.reactive.function:

- Added RouterFunction.andRoute(), a combination of RouterFunction.and()
with RouterFunctions.route()
- ServerRequest.pathVariable() returns String instead of
Optional<String>. An exception is thrown if the variable is not present.
- Added HandlerFilterFunction.andThen and HandlerFilterFunction.apply()
2016-10-20 15:11:16 +02:00
Sebastien Deleuze 921bf5fb70 Use the official RxJava to Reactive Streams adapter
This commit removes the usage of Reactor adapters (about to
be moved from Reactor Core to a new Reactor Adapter module).
Instead, RxReactiveStreams is now used for adapting RxJava
1 and Flowable methods are used for RxJava 2.

Issue: SPR-14824
2016-10-20 15:08:05 +02:00
Arjen Poutsma 7e907c1e83 Align web.reactive.function with WebClient
This commit changes web.reactive.function to reflect the introduction of
the new WebClient. Changes include:

- Request -> ServerRequest
- Response -> ServerResponse
- FilterFunction -> HandlerFilterFunction
- StrategiesSupplier -> HandlerStrategies
2016-10-20 12:35:52 +02:00