Commit Graph

380 Commits

Author SHA1 Message Date
Sebastien Deleuze 8cf5ea91f8 Sync with TestSubscriber changes in reactor-core 2016-06-01 17:55:53 +02:00
Rossen Stoyanchev 65246f8cfd Remove FIXME on retain in ReactorServerHttpRequest
The converters release so this is the right thing to do, not a
temporary fix.
2016-06-01 10:17:12 -04:00
Rossen Stoyanchev a40a8b06bf Polish view resolution 2016-05-31 22:14:17 -04:00
Rossen Stoyanchev 8cc72b320b View resolution with content negotiation
ViewResolutionResultHandler and ResponseBodyResultHandler now share
a common base class ContentNegotiatingResultHandlerSupport that
supports content negotiation.

For view resolution we compare against the supported media types of
resolved View instances, which may include default View's delegating
to an HttpMessageConverter (e.g. JSON, XML, rendering).
2016-05-31 21:51:24 -04:00
Rossen Stoyanchev 5db1a54ff0 Add HttpMessageConverterView 2016-05-31 17:49:21 -04:00
Rossen Stoyanchev a37b2e3a84 Refactor View contract
View now returns Mono<Void> rather than Flux<DataBuffer> which aligns
more closely with the reactive HttpMessageConverter vs the Encoder.

The change was prompted by the upcoming implementation of a View that
delegates to an existing HttpMessageConverter e.g. for JSON, XML.

The resulting change also brings the reactive View closer in spirit to
the View from spring-webmvc which returns void.
2016-05-31 16:50:38 -04:00
Rossen Stoyanchev f8a7024b73 Polish SimpleResultHandler 2016-05-31 16:50:32 -04:00
Rossen Stoyanchev 1b308cffbf Introduce base class for ResponseBodyResultHandler
The ContentNegotiatingResultHandlerSupport base class encapsulates the
logic for content negotiation needed for both @ResponseBody and view
resolution result handling.
2016-05-31 16:33:01 -04:00
Stephane Maldini 3f7178ba9f Sync Reactor 2016-05-31 13:00:51 +01:00
Stephane Maldini 7fc3031c7a update after Schedulers change 2016-05-31 11:11:38 +01:00
Sebastien Deleuze 3f80b4ab2e Polish 2016-05-30 15:26:55 +02:00
Sebastien Deleuze 97155f1a30 Rename ReactiveHttpOutputMessage.setBody() to writeWith() 2016-05-30 15:09:37 +02:00
Rossen Stoyanchev 58307ebac4 Support Model-related return values
This commit adds support for Model-related return values types such as
Map, Model, @ModelAttribute annotated, and non-simple types, which
helps to clarify the logic in ViewResolutionResultHandler.
2016-05-27 20:22:58 -04:00
Rossen Stoyanchev 33c5a19769 Handle unresolved view name 2016-05-27 15:22:22 -04:00
Rossen Stoyanchev a72462cd8c Polish view resolution tests 2016-05-27 15:22:22 -04:00
Rossen Stoyanchev f7d4688b84 Improve 404 "handler not found" handling
Remove handler inserted at the end to generate error in favor of doing
the same using the otherwiseIfEmpty operator.
2016-05-27 15:21:28 -04:00
Brian Clozel c6ed12297f Add Host property in HttpServerSupport
And change the defaults to:

* "0.0.0.0" for the host
* any available port, starting at 8080
2016-05-27 15:50:41 +02:00
Arjen Poutsma 03fe209862 Renamed ReactiveHttpOutputMessage dataBufferFactory() method to bufferFactory() 2016-05-27 10:37:04 +02:00
Arjen Poutsma d36286c7d1 Renamed DataBufferAllocator to DataBufferFactory 2016-05-27 09:51:42 +02:00
Arjen Poutsma 6f46164727 Changed reduceToSingleBuffer to splitOnNewline
In order to be more "reactive", changed StringDecoder's default from
merging all buffers in the stream to a single buffer into splitting the
buffers along newline (\r, \n) characters.
2016-05-27 09:22:57 +02:00
Arjen Poutsma 74abe92804 Added DataBuffer indexOf and lastIndexOf
This commit introduces DataBuffer.indexOf(IntPredicate) and
lastIndexOf(IntPredicate), for finding the index of a byte in a
DataBuffer.
It also introduces DataBufferUtils.tokenize, which tokenizes a
DataBuffer into separate tokens, given a delimiter function.
2016-05-27 09:22:57 +02:00
Rossen Stoyanchev f0c8c4e7a4 Add request path based default view name support 2016-05-26 18:08:18 -04:00
Rossen Stoyanchev 793638e610 Rename ViewResolverResultHandler to ViewResolution~ 2016-05-26 17:48:35 -04:00
Rossen Stoyanchev 8b99c51969 Fix compiler warnings 2016-05-26 17:37:39 -04:00
Rossen Stoyanchev eb9fe235fe Properly handle Mono.empty() for view resolution
This commit ensures correct handling for Mono.empty() return value
where the declared return type is Mono<String> or Mono<View>.
2016-05-26 17:34:52 -04:00
Rossen Stoyanchev 91a5759cf5 Polish result handlers default order 2016-05-26 16:17:56 -04:00
Rossen Stoyanchev bc782902d7 Remove java.util.Optional from View contract 2016-05-26 16:00:08 -04:00
Rossen Stoyanchev 4d04bd5690 Consolidate view resolution under result.view
While View and ViewResolver play the same role as in spring-webmvc they
are now abstracted behind the HandlerResultHandler abstraction so that
top-level contracts don't reference them and the DispatcherHandler is
also unaware of their existence.

Furthermore view resolution and response body handling which are now at
the same level of abstraction (each is a HandlerResultHandler) will
also share code for content negotiation, so it makes sense for them to
be side by side.

This commit moves the reactive.view package to reactive.result.view
with the View and ViewResolver contracts (previously in the top-level
reactive package) also moving there.
2016-05-26 15:55:22 -04:00
Rossen Stoyanchev 318b15c321 Polish 2016-05-26 13:39:16 -04:00
Rossen Stoyanchev 2263954ad7 Respect produces condition in @ResponseBody algorithm 2016-05-26 13:34:08 -04:00
Rossen Stoyanchev a017e2848a Rename ContentTypeResolver to RequestedContentTypeResolver 2016-05-26 11:05:48 -04:00
Rossen Stoyanchev 37404d081e Use ContentTypeResolver for content negotiation 2016-05-26 10:52:19 -04:00
Rossen Stoyanchev 2292e46b04 Update empty return value ResponseBody handling
When a null is returned from an @ResponseBody method, rather than
returning Mono.empty() immediately, convert it to Mono.empty() and
apply the same processing.

Currently that doesn't make a practical difference but it's more
accurate to do it this way. Eventually it may mean the possibility
to turn empty values into something through an extension point
as we do with ResponseBodyAdvice in Spring MVC today.
2016-05-25 17:35:58 -04:00
Rossen Stoyanchev 91d063899b Polish ResponseBody result handling 2016-05-25 17:34:15 -04:00
Rossen Stoyanchev da3b21b020 Fix typo in build script 2016-05-24 15:41:51 -04:00
Rossen Stoyanchev 662e093fbb Temporarily fix RxJava at 1.1.1 to avoid hanging tests
Issue #103
2016-05-24 15:32:18 -04:00
Sebastien Deleuze 5cbc29e61e Upgrade to Tomcat 8.5.2 2016-05-17 13:24:36 +02:00
Stephane Maldini a108268241 fix emit 2016-05-12 11:24:09 +01:00
Stephane Maldini efa5b876fe fix emit 2016-05-12 09:36:28 +01:00
Stephane Maldini f0d28f4b09 fixme : force retain() on incoming bytebuf content 2016-05-06 23:52:23 +01:00
Rossen Stoyanchev 59217243ee Add viewNames for UrlBasedViewResolver 2016-05-05 21:16:21 -04:00
Rossen Stoyanchev aadbf1d8a6 Order ViewResolver's 2016-05-05 20:53:12 -04:00
Rossen Stoyanchev 4d9126a474 Add support for more annotated method arguments
- @PathVariable
 - @RequestHeader
 - @RequestParam
 - @CookieValue
 - @Value
 - @RequestAttribute
 - @SessionAttribute
2016-05-03 23:41:52 -04:00
Stephane Maldini 4e8c21e85a Sync Reactor SignalEmitter 2016-05-04 01:37:11 +01:00
Stephane Maldini 04f47da15e Synchronize Reactor Flux#create / Flux#generate changes 2016-05-03 23:06:07 +01:00
Arjen Poutsma b71f143dfd Polishing 2016-05-03 16:33:56 +02:00
Stephane Maldini b2d9e7c28d Split FluxProcessor factories into individual Processor, remove confusing factories 2016-05-02 22:56:18 +01:00
Stephane Maldini eb21f3ab0a remove lift() 2016-04-28 22:38:26 +01:00
Arjen Poutsma cc8b2109a9 Removed DataBufferUtils.toInputStream
Replaced all usages of toInputStream with non-blocking alternatives.
2016-04-28 16:12:35 +02:00
Arjen Poutsma 8aa7b42cbf Resolved DataBuffer leaks in codec package 2016-04-28 15:21:12 +02:00