Commit Graph

153 Commits

Author SHA1 Message Date
Stephane Maldini 94be412327 Remove last Stream reference 2016-01-07 23:41:48 +00:00
Stephane Maldini b4c3a67d2c Use Stream instead of Streams and uncomment reactor test 2016-01-07 23:29:16 +00:00
Rossen Stoyanchev 97af9998d5 Refine exception handling
Refine exception handling responsibilities between the
DispatcherHandler and the HandlerAdapter.
2016-01-07 18:26:27 -05:00
Stephane Maldini 70b8848492 fix Streams to Stream in test 2016-01-07 22:28:35 +00:00
Rossen Stoyanchev 9a1492e401 Polish 2016-01-07 17:09:49 -05:00
Rossen Stoyanchev a712f43654 Polish 2016-01-07 15:26:11 -05:00
Rossen Stoyanchev c3a8bf4d17 Revert "Remove mandatory dependency on Reactor Stream"
This reverts commit d5e6f70483d4a6c8af3cc5e97e52a54e98199169.
2016-01-07 15:23:55 -05:00
Sebastien Deleuze 318092cfd0 Use Mono#defaultIfEmpty instead of Flux#defaultIfEmpty 2016-01-07 15:58:46 +01:00
Sebastien Deleuze 327c420409 Remove mandatory dependency on Reactor Stream with JarJar 2016-01-07 14:51:43 +01:00
Sebastien Deleuze 8ef7e2ff77 Use Reactor 2.5 Flux and Mono Rx light API
Flux and Mono are used both for implementation and exposed at API
level to express 1 versus N semantic and to provide default Rx
operators:
- Flux<T> for multiple values Publisher (issue #48)
- Mono<T> for single value Publisher (issue #50)
- Mono<Void> for Publisher with no value (issue #49)
2016-01-07 11:14:12 +01:00
Rossen Stoyanchev 8ef2ce44f4 Temporarily remove Reactor from integration tests
https://github.com/spring-projects/spring-reactive/issues/57
2015-12-31 13:18:13 -05:00
Rossen Stoyanchev 0aade73c88 Update Servlet + Undertow req & resp implementations
For those runtimes that don't directly support Reacitve Streams this
commit separates more formally Reactive Streams bridge code out of
the request and response implementations which become simple adapters
to the ServerHttpRequest/Response contracts like their RxNetty and
Reactor Net counterparts.
2015-12-31 12:55:09 -05:00
Rossen Stoyanchev 869f6bef40 Polish server request & response implementations 2015-12-31 12:27:40 -05:00
Rossen Stoyanchev 6b05d17248 Response headers always in sync with native response
ServerHttpResponse implementations now immediately propagate
HttpHeaders changes as they so there is no need to call applyHeaders().

The writeHeaders from ServerHttpResponse is also removed. RxNetty and
Reactor Net both support implicitly completing if the handler
completes without explicitly writing the headers or the response body.
2015-12-29 23:13:21 -05:00
Rossen Stoyanchev 34eb6d5426 Add support for @ExceptionHandler methods 2015-12-29 23:13:21 -05:00
Rossen Stoyanchev 8c89b478d9 Add operator for deferred writes 2015-12-29 23:13:21 -05:00
Rossen Stoyanchev 9789db23d2 Rename HandlerResult fields from value to result 2015-12-29 23:13:21 -05:00
Rossen Stoyanchev 84e3ad342b Remove @Ignore from 404 status code tests 2015-12-29 23:13:21 -05:00
Rossen Stoyanchev 9eb07b7780 Update package for reactor Signal 2015-12-29 23:13:21 -05:00
Rossen Stoyanchev a12c172ceb Switch to rxnetty-http dependency
The "rxnetty" artifact is old (October 2015). There is now rxnetty-http
and other modules that have more recent snapshots (December 2015).
2015-12-29 23:13:21 -05:00
Stephane Maldini da4e4aab39 test operator log 2015-12-18 16:56:17 +00:00
Stephane Maldini 15185c75a3 use Publishers.onErrorResumeNext 2015-12-17 13:34:09 +00:00
Rossen Stoyanchev 69973d984d Fix test failure 2015-12-16 12:30:15 -05:00
Rossen Stoyanchev 623874b4d0 Constant HandlerNotFoundException 2015-12-16 11:08:41 -05:00
Rossen Stoyanchev 1b3289d0d5 Add InternalServerErrorExceptionHandler 2015-12-15 17:04:53 -05:00
Rossen Stoyanchev f2cd92a243 Fix imports 2015-12-15 12:09:23 -05:00
Rossen Stoyanchev c13a8c9bb4 DispatcherHandler maps errors to ResponseStatusException
The DispatcherHandler now has an errorMapper property that is a
function for transforming errors. By default this property is set to an
instance of DispatcherHandlerExceptionMapper which wraps "standard"
framework exceptions and @ResponseStatus-annotated exceptions as
ResponseStatusException.

This makes it easy to handle the exceptions downstream uniformly.
2015-12-15 12:08:13 -05:00
Rossen Stoyanchev 1f15b7e074 Add ResponseStatusException
This change adds a ResponseStatusException to associate an exception
with a status code at runtime. Along with that is an
ResponseStatusExceptionHandler that handles ResponseStatusException
by setting the response status.
2015-12-15 12:06:53 -05:00
Rossen Stoyanchev 5231e7da7b Fix failing test 2015-12-10 16:50:28 -05:00
Rossen Stoyanchev a0018d13e1 Add DispatcherHandlerErrorTests
The tests demonstrate failures at various phases of request processing
and the resulting error signals.
2015-12-10 16:35:40 -05:00
Rossen Stoyanchev 4ba3d0736f Add HttpExceptionHandler 2015-12-10 16:35:40 -05:00
Rossen Stoyanchev 448aac813a Add MockServerHttpRequest/Response 2015-12-10 16:35:40 -05:00
Sebastien Deleuze 78454f5a2e Add a link to Spring Reactive Playground 2015-12-09 11:18:50 +01:00
Rossen Stoyanchev ef3560a55a Add HttpHandlerDecorator and fix test package 2015-12-08 22:50:25 -05:00
Rossen Stoyanchev 1dcaff8a5c Updates to Javadoc 2015-12-08 22:50:24 -05:00
Stephane Maldini fbb0c702c9 minor reactor server impl to fulfill core introspection 2015-12-09 01:58:53 +00:00
Rossen Stoyanchev ad4be9462b Drop use of WebApplicationContext in tests
It brings along Servlet imports.
2015-12-08 14:33:23 -05:00
Stephane Maldini 4616938525 Prepare for a future change to downstream() inner method in reactor-core 2015-12-08 13:21:35 +00:00
Rossen Stoyanchev 45706422dd InvocableHandlerMethod and arg resolution updates
General improvements e.g. make use of Java 8 Stream. The main reason
for the refactoring however to tighten error handling. To that extent:

InvocableHandlerMethod turns all exceptions into Reactive Streams
error signals, in effect never allowing any Exceptions to bubble up.

HandlerMethodArgumentResolver may throw an Exception for sync resolution
or produce an error signal via the returned Publisher. Either way the
exception is consistently wrapped with helpful method argument details.
For the latter case using a custom mapError operator.

HandlerMethodArgumentResolver no longer needs to return Optional for
nullable argument values. Instead (for now) the defaultIfEmpty operator
of reactor.rx.Stream operator is used to ensure a default constant value
(called "NO_VALUE") is produced. That way an argument resolver may
produce 0..1 values where 0 means it did not resolve to any value and
that results in null passed as the argument value.

If a HandlerMethodArgumentResolver produces more than one value, all
additional values beyond the first one will be ignored with the help
of a custom "first" operator.

As HandlerMethod is invoked within the map operator, checked exceptions
are not allowed but instead of wrapping it in a runtime exception what
we really need is to unwrap the target exception for exception
resolution purposes. To this end concatMap is used to produce a nested
Publisher or an error Publisher with the unwrapped target exception.

Related to that InvocableHandlerMethod now returns
Publisher<HandlerResult> instead of Publisher<Object> so that no longer
needs to be externally mapped from Object to HandlerResult.

InvocableHandlerMethodTests provides tests for the above scenarios and
verifies the details of resulting error signals.
2015-12-07 17:36:58 -05:00
Sebastien Deleuze ce0bd2efc2 Improve Gradle dependencies version management
This commit also updates to the following dependencies:
 - Spring Framework 4.2.3.RELEASE
 - RxJava 1.1.0
2015-12-07 11:35:00 +01:00
Rossen Stoyanchev da98becf72 Move http.server to http.server.reactive 2015-12-02 17:46:07 -05:00
Rossen Stoyanchev 382c98f968 Remove isolated use of Reactor Buffer 2015-12-01 18:19:14 -05:00
Rossen Stoyanchev df80ffbf28 Spring-consistent naming in server.http package
This change also removes reactor-stream variants of the request and
response since the request and response aren't used directly by
application code and get passed through reactor.Publishers anyway.
2015-12-01 18:09:53 -05:00
Stephane Maldini b9a52d5f7c Change to Definitive generic signature for Publishers.zip 2015-12-01 16:51:52 +00:00
Stephane Maldini 9ce5c7416b compiler issue ? 2015-12-01 15:01:34 +00:00
Rossen Stoyanchev 71d1d11fac Non-blocking HandlerMapping chain 2015-12-01 07:34:35 -05:00
Stephane Maldini b26e746120 Use Publishers.zip instead of Streams.zip 2015-12-01 10:43:41 +00:00
Sebastien Deleuze 91c2b7afad Support handler methods returning void, Observable<Void>, etc. 2015-11-30 15:35:58 +01:00
Rossen Stoyanchev 57dc8199fb Add ReactiveHttpFilter 2015-11-25 13:11:01 -05:00
Sebastien Deleuze 0f8a4bf706 Polish imports 2015-11-25 10:42:23 +01:00