Commit Graph

13436 Commits

Author SHA1 Message Date
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
Arjen Poutsma 0cfb6b37f2 Align Reactive WebClient with web.reactive.function
This commit refactors the web client to be more similar to
web.reactive.function. Changes include:

- Refactor ClientWebRequest to immutable ClientRequest with builder and
   support for BodyInserters.
- Introduce ClientResponse which exposes headers, status, and support
   for reading from the body with BodyExtractors.
- Removed ResponseErrorHandler, in favor of having a ClientResponse
   with "error" status code (i.e. 4xx or 5xx). Also removed
   WebClientException and subclasses.
- Refactored WebClientConfig to WebClientStrategies.
- Refactored ClientHttpRequestInterceptor to ExchangeFilterFunction.
- Removed ClientWebRequestPostProcessor in favor of
   ExchangeFilterFunction, which allows for asynchronous execution.

Issue: SPR-14827
2016-10-20 12:35:23 +02:00
Arjen Poutsma dc1926a861 Moved BodyExtractor and BodyInserter to http.codec
This commit moves the web.reactive.function.[BodyInserter|BodyExtractor]
to http.codec, so that they can be used from the client as well.

Furthermore, it parameterized both inserter and extractor over
ReactiveHttpOutputMessage and ReactiveHttpInputMessage respectively, so
that they can be limited to only be used on the client or server.
2016-10-20 11:44:01 +02:00
Rossen Stoyanchev ed6c533079 Merge pull request #1211 from sdeleuze/SPR-14798 2016-10-19 16:31:56 -04:00
Rossen Stoyanchev 72397e3505 Polish
Issue: SPR-14798
2016-10-19 16:30:52 -04:00
Sebastien Deleuze 50f2cda009 Better encapsulation for CORS default permit configuration
This commit also improves CorsRegistration Javadoc.

Issue: SPR-14798
2016-10-19 15:31:22 -04:00
Violeta Georgieva 25e7cd577d Handle AsyncListener.onComplete in Servlet adapter
Typically the Mono<Void> from the HttpHandler also reflects the
completion of the request and response body processors and at that
point invoking AsyncContext#complete() from HandlerResultSubscriber
should be sufficient.

This commit explicitly propagates the AsyncListener.onComplete event
to the request and response body processors for added safety.
Technically as mentioned those processors should have completed but
depending on how the controller is written there is a possibility
the body processors may not have completed.

Issue: SPR-14772
2016-10-19 14:28:24 -04:00
Arjen Poutsma 139eb9a580 Merge pull request #1210 from violetagg/grow-data-buffer
* grow-data-buffer:
  DefaultDataBuffer improvements
2016-10-18 13:48:08 +02:00
Violeta Georgieva 882b075fdf DefaultDataBuffer improvements
DefaultDataBuffer.grow(int):
- Copy only the remaining data
- Update readPosition/writePosition
2016-10-18 14:39:08 +03:00
Rossen Stoyanchev ec1eb14280 Add getPrincipal to ServerWebExchange
ServerWebExchange now has a getPrincipal method and along with that a
ServerWebExchangeDecorator that can be used to wrap the exchange in
order to return the authenticated user.

Issue: SPR-14680
2016-10-17 17:48:22 -04:00
Stephane Nicoll 7565355deb Merge pull request #1205 from marschall:SPR-14810
* pr/1205:
  Fix NativeJdbcExtractors documentation
2016-10-15 11:57:34 +03:00
Philippe Marschall f7c79295f3 Fix NativeJdbcExtractors documentation
The documentation mentions various NativeJdbcExtractors that no longer
exist. To be specific CommonsDbcpNativeJdbcExtractor and
XAPoolNativeJdbcExtractor no longer exist.

This commit includes the following changes:

 * remove CommonsDbcpNativeJdbcExtractor references from Asciidoctor
 * remove CommonsDbcpNativeJdbcExtractor references from Javadoc
 * remove XAPoolNativeJdbcExtractor references from Asciidoctor

Issue: SPR-14810
Closes gh-1205
2016-10-15 11:56:57 +03:00
Stephane Nicoll 33bf439a74 Merge pull request #1206 from marschall:SPR-14811
* pr/1206:
  Fix formatting
  Replace J2EE with Java EE
2016-10-15 11:55:30 +03:00
Stephane Nicoll fc8bad36c9 Fix formatting
Closes gh-1206
2016-10-15 11:55:07 +03:00
Philippe Marschall ae5b0c6fb5 Replace J2EE with Java EE
String with version 5 the name of Java Platform, Enterprise Edition
changed from J2EE to Java EE. However a lot of the documentation still
uses the term J2EE.

This commit includes the following changes:

 * replace J2EE with Java EE where appropriate

This is not a blind search and replace. The following occurrences
remain unchanged:

 * references to old J2EE releases, most notably 1.3 and 1.4.
 * references to "Expert One-On-One J2EE Design and Development"
 * references to "Core J2EE patterns"
 * XML namespaces
 * package names

Issue: SPR-14811
See gh-1206
2016-10-15 11:49:00 +03:00
Rossen Stoyanchev 8619ad9d9a Add tests to DelegatingWebReactiveConfigurationTests 2016-10-14 21:06:42 -04:00