Commit Graph

501 Commits

Author SHA1 Message Date
Sebastien Deleuze
48d67a245b Add support for RxJava 2
This commit adds support for RxJava 2 Completable,
Single, Observable and Flowable types (io.reactivex package).

Issue: SPR-14628
2016-09-01 14:48:16 +02:00
Sebastien Deleuze
b4641b2306 Polishing 2016-09-01 14:48:16 +02:00
Arjen Poutsma
f1319f58ec Introduce new functional web API
This commit introduces a new, functional web programming model in the
org.springframework.web.reactive.function package. The key types
are:

 - Request and Response are new Java 8-DSLs for access to the HTTP
   request and response
 - HandlerFunction represents a function to handle a request to a
   response
 - RoutingFunction maps a request to a HandlerFunction
 - FilterFunction filters a routing as defined by a RoutingFunction
 - RequestPredicate is used by Router to create RoutingFunctions
 - RequestPredicates offers common RequestPredicate instances
2016-09-01 14:38:13 +02:00
Arjen Poutsma
16b525f698 Refactored SseEvent to ServerSentEvent
- Renamed SseEvent to ServerSentEvent to make the name less redundant.
 - ServerSentEvent is now immutable, having a builder to create new instances.
 - Realigned the class properties to more closely match the events
   described in the spec, so that `reconnectTime` becomes `retry`, and
   `name` becomes `event`.
2016-09-01 13:47:50 +02:00
Juergen Hoeller
e08b1b75b6 @PathVariable supports 'required' attribute (for model attribute methods)
Issue: SPR-14646
2016-08-31 14:43:39 +02:00
Juergen Hoeller
31c5644691 ResponseStatusExceptionHandler in web.server.handler (plus related polishing) 2016-08-30 23:58:14 +02:00
Rossen Stoyanchev
391752abc2 Polish and update reactive getting started reference
This commit updates the instructions on getting started with
Spring Web Reactive and also updates constructors and setters to
streamline the getting started procedure.

Issue: SPR-14640
2016-08-30 14:36:19 -04:00
Brian Clozel
960d335c35 Don't wrap resolver exceptions in InvocableHandlerMethod
Prior to this commit, exceptions thrown by the
`HandlerMethodArgumentResolver` would be wrapped into
`IllegalStateException`s.

This commit makes sure that a DEBUG log is written with the relevant
information and that the root cause is not wrapped into another
exception, so that the appropriate `ExceptionHandler` can be used to
deal with this error.

Issue: SPR-14618
2016-08-30 11:50:40 +02:00
Sam Brannen
d6d05e8ca0 Remove trailing whitespace in Java source code 2016-08-29 15:25:10 +02:00
Rossen Stoyanchev
cc288a0c4a Switch back to Reactor 3.0 snapshots 2016-08-08 16:42:30 -04:00
Sebastien Deleuze
5531e80724 Anticipate reactor.test.TestSubscriber removal
reactor.test.TestSubscriber will not be part of Reactor Core
3.0.0 since it needs to be refactored to fit all the needs
expressed by the users. It is likely to be back later in one
of the Reactor Core 3.0.x releases.

This commit anticipate this removal by temporarily copying
TestSubscriber in spring-core test classes. As soon as
the new TestSubscriber will be available in Reactor Core,
Spring Framework reactive tests will use it again.
2016-08-08 11:24:21 +02:00
Rossen Stoyanchev
460ed307ed Shorten getter for ReactiveAdapterRegistry 2016-07-27 17:03:56 -04:00
Rossen Stoyanchev
143b5c89dd Add support for rx.Completable as return value 2016-07-27 17:00:27 -04:00
Rossen Stoyanchev
79bc227c9d Remove SimpleResultHandler
There is really no need for a result handler dedicated to a void
return value and it's actually problematic to have it.

Each result handler treats void as necessary. For an @ResponseBody
method it means an empty body. For view resolution it means no specific
value was returned and we should procede with selecting a default view
name. Having a dedicated void result handler can interfere with this
especially since view resolution needs to be last in order.

At the same time there are cases when no result handling is needed
and the response is fully handled within the HandlerAdapter. This is
the case with WebHandler and the SimpleHandlerAdapter. For that case
we simply return mono.then(aVoid -> Mono.empty()) which effectively
returns an empty Mono and no result handling follows. The
HandlerAdapter already says you can return no values at all if the
response is fully handled.
2016-07-27 17:00:27 -04:00
Rossen Stoyanchev
3ab21741f9 Use Jetty again in SseIntegrationTests 2016-07-27 13:26:51 -04:00
Juergen Hoeller
e03dea1d64 Polishing 2016-07-26 17:15:19 +02:00
Juergen Hoeller
c13f8419f9 Minor revision of reactive support layout (ahead of 5.0 M1)
DataSourceUtils moved to main core.io.buffer package.
Consistently named Jackson2JsonDecoder/Encoder and Jaxb2XmlDecoder/Encoder.
Plenty of related polishing.
2016-07-26 15:39:32 +02:00
Rossen Stoyanchev
10c90a677c Move http.converter.reactive to http.codec 2016-07-22 14:14:46 -04:00
Arjen Poutsma
b0d7625e3e Reactor StringEncoder into CharSequenceEncoder
This commit refactors the StringEncoder to a CharSequenceEncoder, in
order to support StringBuilders, Groovy GStrings, etc.

Issue: https://github.com/spring-projects/spring-reactive/issues/120
2016-07-22 12:47:46 -04:00
Rossen Stoyanchev
0f6505e32f Add timeout settings in SseIntegrationTests 2016-07-22 12:42:35 -04:00
Rossen Stoyanchev
101220bad1 Add ReactiveAdapterRegistry
Issue: SPR-14159
2016-07-22 12:21:28 -04:00
Sebastien Deleuze
9fb8a2eb2e Add contextClass resolution to JacksonJsonDecoder
Issue: SPR-14158
2016-07-21 14:57:50 +02:00
Sebastien Deleuze
903770f008 Add JsonView and type resolution support to JacksonJsonEncoder
Issue: SPR-14158
2016-07-21 13:19:52 +02:00
Arjen Poutsma
7b2196b408 Add writeAndFlushWith to ReactiveHttpOutputMessage
This commit changes the reactive flushing mechanism to use a newly
introduced writeAndFlushWith(Publisher<Publisher<DataBuffer>>) on
ReactiveHttpOutputMessage instead of using the FlushingDataBuffer.

Issue: https://github.com/spring-projects/spring-reactive/issues/125
2016-07-21 11:08:54 +02:00
Juergen Hoeller
99be15f58b Revise encoding steps towards use of JDK Charset and StandardCharsets
Issue: SPR-14492
2016-07-19 23:43:06 +02:00
Juergen Hoeller
adc595b5f1 Avoid dependency on WebUtils for extracting file extension
Issue: SPR-14479
2016-07-19 23:30:33 +02:00
Juergen Hoeller
aaac199e8b Consistently use constructor-based instantiation instead of Class.newInstance / BeanUtils.instantiate
Issue: SPR-14486
2016-07-19 19:21:06 +02:00
Juergen Hoeller
8bb34bc962 Resource.isFile() and JAF MediaTypeFactory
Issue: SPR-14484
2016-07-19 18:53:31 +02:00
Rossen Stoyanchev
4b92bf2af1 Split HttpMessageConverter into ~Reader and ~Writer 2016-07-18 22:16:35 -04:00
Rossen Stoyanchev
3e096ce810 Improve javadoc on reactive classes
Ensure type-level Javadoc in every class, comply with guidelines for
80 char on Javadoc, and minor polish.
2016-07-18 14:59:15 -04:00
Rossen Stoyanchev
2029b6e0b7 Disable failing Jetty SSE tests for now
https://github.com/eclipse/jetty.project/issues/730
2016-07-15 17:27:51 -04:00
Rossen Stoyanchev
028be2a298 Switch to Reactor 3 snapshots and Netty 4.1.3 2016-07-15 17:16:26 -04:00
Sam Brannen
841480596e Clean up warnings in Gradle build 2016-07-15 17:38:35 +02:00
Rossen Stoyanchev
d2e105f28d Add @Since 5.0 and package-info for reactive classes 2016-07-14 17:40:17 -04:00
Rossen Stoyanchev
5d1b542698 Move spring-web-reactive classes to spring-web 2016-07-14 12:30:35 -04:00
Rossen Stoyanchev
2e8326220b Move spring-web-reactive classes to spring-core 2016-07-14 12:30:30 -04:00
Rossen Stoyanchev
1022683d1c Fix compiler warnings 2016-07-14 12:18:47 -04:00
Arjen Poutsma
56e50d6d68 Moved body processor to writeWithInternal()
Moved ResponseBodyProcessor creation from constructor to
writeWithInternal(), in preparation of supporting both
Publisher<DataBuffer> as well as Publisher<Publisher<DataBuffer>>.
2016-07-13 12:04:40 +02:00
Arjen Poutsma
7519d1de41 Moved log4j config to test tree
Moved log4j.properties from the main source tree to the test tree.
2016-07-13 09:56:45 +02:00
Arjen Poutsma
f82f17d7f7 Moved Servlet Publisher and Processor
In preparation of supporting both Publisher<DataBuffer> and
Publisher<Publisher<DataBuffer>> as response body, moved
RequestBodyPublisher and ResponseBodyProcessor into
ServletServerHttpRequest and ServletServerHttpResponse respectively.
2016-07-13 09:53:39 +02:00
Arjen Poutsma
392a1660a4 Polishing 2016-07-13 09:53:39 +02:00
Arjen Poutsma
e64907eed8 Removed ServletAsyncContextSynchronizer 2016-07-13 09:53:39 +02:00
Arjen Poutsma
d2fce24eb4 Introduced ResponseBodyWriteResultPublisher
Refactored Publisher<Void> in AbstractResponseBodyProcessor into
separate ResponseBodyWriteResultPublisher.
2016-07-13 09:53:39 +02:00
Brian Clozel
e906a78e0f Move server testing infrastructure to test sources 2016-07-12 17:36:30 +02:00
Arjen Poutsma
d736245f28 Changed from interval() to intervalMillis() 2016-07-12 13:25:18 +02:00
Stephane Maldini
c2c7e3b596 Polish timed operators and remove useTimer() 2016-07-12 12:13:50 +01:00
Rossen Stoyanchev
aa47616be2 Split TestRestController into use-case sub-classes 2016-07-11 18:08:11 -04:00
Rossen Stoyanchev
7e07fb16d8 Split RequestMappingIntegrationTests into sub-classes 2016-07-11 18:08:11 -04:00
Rossen Stoyanchev
35f791acf8 Extract base class for RequestMappingIntegrationTests 2016-07-11 18:08:11 -04:00
Rossen Stoyanchev
6fde86903d Declare HTTP method mappings TestRestController 2016-07-11 18:07:55 -04:00