Commit Graph

214 Commits

Author SHA1 Message Date
Rossen Stoyanchev
33a7b91e57 Add abstract case class HandlerMappings
This commit adds AbstractHandlerMethodMapping, a starting point for
AbstractHandlerMapping, and HttpRequestPathHelper with a similar
purpose to UrlPathHelper but based with ServerWebExchange as input.
2016-04-15 04:08:19 -04:00
Rossen Stoyanchev
341f23e0e6 Add "result" package under ~.web.reactive
The new package is parallel to the "mvc" package under spring-webmvc
and a place to hold the various programming model styles.
2016-04-14 16:15:44 -04:00
Rossen Stoyanchev
3460e577ad Polish "simple" handler support
- correct name of HttpHandlerHandlerAdapter to WebHandlerHandlerAdapter
- shorten SimpleHandlerResultHandler to SimpleResultHandler
- add HandlerResult constructor without Model
- update tests
2016-04-14 15:17:28 -04:00
Brian Clozel
a3b371bf4b Accept all media types in StringDecodere
This commit adds the "*/*" media type in the list of compatible media
types for the StringDecoder. This allows this decoder to decoder
payloads of any media type as long as the target type is String.

Fixes #87
2016-04-08 22:18:46 +02:00
Brian Clozel
023dafa903 Support "text/*" media types in StringDecoder 2016-04-07 16:06:56 +02:00
Brian Clozel
e3f87b3e3a Polish 2016-04-07 16:06:56 +02:00
Brian Clozel
09327181c4 Improve ClientHttpRequestFactory javadoc
This commit underlines the fact that the request created by a
ClientHttpRequestFactory should be augmented with a message body using
the `ClientHttpRequest#setBody` method before it is executed.

See #82
2016-04-07 16:06:56 +02:00
Brian Clozel
ddf996cfeb Polish HttpRequestBuilder API
This commit makes messageEncoders a required argument for building a
client request - those are needed to actually encode the body object as
a reactive stream to be written to the HTTP request body.

Removed raw types usage in DefaultHttpRequestBuilder.

DefaultHttpRequestBuilder now uses a UriTemplateHandler to expand URI
templates + variables into a concrete URI.

Fixes #80, fixes #85, fixes #86
2016-04-07 16:06:56 +02:00
Brian Clozel
8ed2925ce3 Propagate Errors in DefaultHttpRequestBuilder
This commit introduces the new `WebClientException` for wrapping
client-side exceptions.
This exception is now thrown when now message encoder can be found for
writing the request body as an HTTP request message.

Fixes #83
2016-04-07 16:06:56 +02:00
Brian Clozel
e2a07659ab Add generics support for WebResponseExtractors
This commit adds generics support for WebResponseExtractors.
Types should be described using a ResolvableType, which can be
created with static methods like:

    // for the type Event<Registration>
    ResolvableType.forClassWithGenerics(Event.class, Registration.class)

Fixes #89
2016-04-07 16:06:56 +02:00
Sebastien Deleuze
24a63f1d90 Upgrade RxNetty to 0.5.2-SNAPSHOT and Tomcat to 8.0.33 2016-04-07 16:04:39 +02:00
Arjen Poutsma
75399814cd Improve Jaxb2Decoder
- Introcuces XmlEventDecoder which decodes from DataBuffer to
  javax.xml.stream.events.XMLEvent. It uses the Aalto async XML API if
  available, but falls back to a blocking default if not.

- Refacors Jaxb2Decoder to use said XmlEventDecoder, and split the
  stream of events into separate substreams by using the JAXB annotation
  value, one stream for each part of the tree that can be unmarshaled to
  the given type.

- Various improvements in the JAXB code.
2016-04-06 16:22:49 +02:00
Arjen Poutsma
a8f27af5fb Polishing. 2016-04-06 16:20:08 +02:00
Rob Winch
fd6fc30eea Add RequestPostProcessor
Fixes gh-81
2016-03-31 12:33:45 -05:00
Arjen Poutsma
75d006d2f9 Improve StringDecoder. 2016-03-31 11:31:02 +02:00
Arjen Poutsma
d9d76ecd19 Polishing 2016-03-24 09:39:58 +01:00
Arjen Poutsma
35e511b03f Resolved comments from review
This commit resolves a few comments brought forward during a review
meeting, specifically:

- It renames AbstractResponseBodyPublisher to
  AbstractRequestBodyPublisher.
- It separates out registration logic into a register method.
- It moves the RequestBodyPublisher and ResponseBodySubscriber for the
  Servlet 3.1 support back into ServletHttpHandlerAdapter.
2016-03-23 17:04:18 +01:00
Arjen Poutsma
d20b0003c6 Refactoring of Servlet 3.1 and Undertow support
- Introduce abstract base class for Servlet 3.1 and Undertow support
- Simplify Undertow support
2016-03-23 16:02:44 +01:00
Arjen Poutsma
f7c6c69e51 Improve JacksonJsonEncoder
This commit removes the need for the custom Subscriber in
JsonObjectEncoder, and replaces it with higher-level Flux and Mono-based
solution.
2016-03-21 11:37:51 +01:00
Arjen Poutsma
7f786ce4d7 Added DataBufferAllocator property to ReactiveHttpOutputMessage, and use that to pass on to Encoder.encode(). 2016-03-18 16:14:33 +01:00
Arjen Poutsma
1836b2825b Added DataBufferAllocator parameter to Encoder.encode, and use that instead of AbstractAllocatingEncoder base class. 2016-03-18 16:05:30 +01:00
Arjen Poutsma
e56dda1864 Make JsonObjectDecoder use allocator property on DataBuffer. 2016-03-18 14:11:25 +01:00
Arjen Poutsma
b838fdab88 Added allocator property to DataBuffer 2016-03-18 12:16:23 +01:00
Arjen Poutsma
273c1b85e6 Reduced batch size to 1, so that we don't block on init. 2016-03-18 11:58:55 +01:00
Arjen Poutsma
5519428d43 Replaced DataBufferPublisherInputStream with JDK equivalent. 2016-03-18 10:02:28 +01:00
Rossen Stoyanchev
72dbe9012e Add cookies to ClientHttpRequest/Response 2016-03-17 21:04:50 -04:00
Rossen Stoyanchev
e19abf9c90 Rename ServerCookie to ResponseCookie
HttpCookie-ResponseCookie follows HttpEntity-ResponseEntity and also
avoids use of "Server" outside of server sub-package.
2016-03-17 15:28:55 -04:00
Stephane Maldini
530c817287 sync reactor-netty 2016-03-12 01:16:49 +00:00
Stephane Maldini
13ddfb4aab update package 2016-03-11 22:15:11 +00:00
Rossen Stoyanchev
e97a55ad54 WebClient supports Void response body
WebResponseExtractor uses Mono.when with the response status, headers,
and the decoded body. However when the response body stream is empty
then when completes empty too.

This change adds defaultIfEmpty handling for en empty response body.
2016-03-07 17:07:12 -05:00
Rossen Stoyanchev
b2648f84ad DefaultWebSessionManager supports multiple sessions
Issue: #64
2016-03-07 11:20:51 -05:00
Rossen Stoyanchev
ca7aeaae35 WebSessionIdResolver now returns List of ids
Issue: #64
2016-03-03 22:32:03 -05:00
Rossen Stoyanchev
dbc6478b8a Refactor HTTP Cookie support
There is now an HttpCookie (simple name-value pair) and separately a
ServerHttpCookie sub-class with additional attributes that a server
can send to clients.

HttpHeaders is no longer the place to access cookies. Instead there is
a read-only HttpCookie map on ServerHttpRequest and a mutable
ServerHttpCookie map on ServerHttpResponse.

Cookies are stored in a map that preserves their order.
2016-03-03 22:17:39 -05:00
Stephane Maldini
ce4a687cf2 remove reactor-stream and related artefacts, update tests 2016-03-03 23:57:03 +00:00
Stephane Maldini
4197f002d8 Arrange WriteWithOperator to save some allocation cost with the same technique used by RSC and Reactor 2016-02-28 11:49:00 +00:00
Stephane Maldini
423a4852c5 use EmptySubscription 2016-02-28 11:29:46 +00:00
Stephane Maldini
fc1b2e96f7 Introduce Mono#justOrEmpty(T) 2016-02-28 00:56:10 +00:00
Stephane Maldini
999dfe3925 Sync BaseSubscriber 2016-02-27 23:18:22 +00:00
Stephane Maldini
24d9e99de1 Sync toCompletableFuture 2016-02-27 21:36:31 +00:00
Stephane Maldini
cc77a338b1 Sync reactor-core jdk8 bump 2016-02-27 13:34:15 +00:00
Stephane Maldini
9f94f8c88e Sync to Fluxion to remove Stream confusion 2016-02-26 21:42:52 +00:00
Arjen Poutsma
361707c448 Servlet 3.1 support cleanup
Claneup of the Servlet 3.1 support:

 - moved RequestBodyPublisher to ServletServerHttpRequest
 - moved ResponseBodySubscribera to ServletServerHttpResponse
 - response body is now copied to ServletOutputStream in chunks, rather
   than one big byte[]
2016-02-23 14:35:49 +01:00
Arjen Poutsma
2fcbeb6595 Fixed issue with DefaultDataBuffer.asInputStream() 2016-02-23 14:14:34 +01:00
Arjen Poutsma
51a90465d4 Polishing 2016-02-23 10:24:18 +01:00
Arjen Poutsma
f036f745a6 Improved RxNetty support. 2016-02-18 15:49:45 +01:00
Brian Clozel
d68ff29e9b Use default buffer allocator in RequestMappingHandlerAdapter
This commit removes RequestMappingHandlerAdapter's hard dependency on
Netty by switching to the DefaultDataBufferAllocator.
2016-02-10 23:16:48 +01:00
Rossen Stoyanchev
29db80c3e8 Add FreeMarker View, ViewResolver and basic hierarchy 2016-02-08 18:13:42 -05:00
Rossen Stoyanchev
55d37c0522 Add View, ViewResolver, and ViewResolverResultHandler
This commit adds a View and ViewResolver contracts to support HTML
template based rendering.

ViewResolverResultHandler applies view resolution by iterating the
resolvers to resolve to a view and then use it to render.
2016-02-08 18:13:37 -05:00
Rossen Stoyanchev
14997eccf3 Support Model as method argument and in HandlerResult
A model is created and passed to argument resolvers including a new
ModelArgumentResolver. The model is then exposed for result handling
as a field in HandlerResult.
2016-02-08 18:04:07 -05:00
Rossen Stoyanchev
e92174c772 Update HandlerResult
Rename result to returnValue and resultType to returnValueType to
reflect what they represent.

The returnValue getter is also wrapped as Optional since the value
returned from a handler may be null (e.g. void method, null value).
2016-02-07 21:50:56 -05:00