Commit Graph

800 Commits

Author SHA1 Message Date
Juergen Hoeller 69f14a2038 ClassPathResource.isReadable() checks InputStream (for jar directories)
Resource.isReadable() is defined to semantically imply exists() now.

Issue: SPR-16832
2018-05-29 21:47:33 +02:00
Juergen Hoeller 8593fec22c Avoid ConstantConditions warnings suppression (plus related polishing)
Issue: SPR-15756
2018-05-29 21:47:10 +02:00
Arjen Poutsma 8c30b8e628 Fix parent path variables in nested route functions
This commit fix an issue where path variables in a nested parent
RouterFunction were not committed to the request attributes.

Issue: SPR-16868
2018-05-29 15:48:31 +02:00
Rossen Stoyanchev 2acf91a438 Polish 2018-05-26 09:24:23 -04:00
Rossen Stoyanchev d77797f42c Improve readability of Body[Inserters|Extractors] 2018-05-25 13:32:00 -04:00
Rossen Stoyanchev 85e8634810 Properly initialize URI/Matrix vars w/ urlDecode=false
Issue: SPR-16867
2018-05-24 15:08:39 -04:00
Rossen Stoyanchev 82480a7908 Update docs on WebClient filters 2018-05-24 07:16:54 -04:00
Rossen Stoyanchev b472d192f4 Improve support for caching encoded resources
The key in CachingResourceResolver now includes the "Accept-Encoding"
request header cleaned to exclude "*", "identity", and parameters, and
also sorted alphabetically.

For encoded resources the response now includes a response header with
"Vary: Accept-Encoding".

Issue: SPR-16381
2018-05-23 09:17:21 -04:00
Rossen Stoyanchev 9274de390a Polish resource handling tests 2018-05-23 09:17:21 -04:00
Rossen Stoyanchev f121aa5e31 Immutable Resource[Resolver|Transformer]Chains
Issue: SPR-16862
2018-05-23 09:17:21 -04:00
Rossen Stoyanchev 5207672b3f Configurable support for static resource encodings
The new EncodedResourceResolver is a generalized version of
GzipResourceResolver that can be configured to support different
content codings, by "br" and "gzip".

GzipResourceResolver is now deprecated.

Issue: SPR-16381
2018-05-23 09:17:21 -04:00
Rossen Stoyanchev 1f8476aaf3 Add missing @param 2018-05-21 21:09:29 -04:00
Stephane Nicoll 36f8d49c4a Polish 2018-05-19 10:32:25 +02:00
Rossen Stoyanchev 192c7a5627 WebSession to WebSocketSession attribute passing
This commit makes it possible to pass attributes from the WebSession of
a handshake request to the WebSocketSession, by configuring a
Predicate<String> on HandshakeWebSocketService.

Issue: SPR-16212
2018-05-18 21:32:46 -04:00
Rossen Stoyanchev 9074828478 Add attributes to WebFlux WebSocketSession
Issue: SPR-16212
2018-05-18 21:32:46 -04:00
Juergen Hoeller 285eb94a03 Upgrade to Hibernate Validator 6.0.10 2018-05-18 22:22:12 +02:00
Juergen Hoeller 6710291bbd Polishing 2018-05-18 22:21:33 +02:00
Rossen Stoyanchev ade2eab169 Polish WebFlux WebSocket docs
Issue: SPR-16820
2018-05-17 10:02:54 -04:00
Arjen Poutsma b03905e2b0 Improve toString for filtered router function
Issue: SPR-16829
2018-05-17 12:32:57 +02:00
Rossen Stoyanchev 543f190239 Expand WebFlux docs with WebSocketHandler examples
Issue: SPR-16820
2018-05-16 21:30:31 -04:00
Rossen Stoyanchev 4ff4d5a181 Allow client-side use of BodyExtractors#toFormData
Issue: SPR-16804
2018-05-16 10:41:50 -04:00
Rossen Stoyanchev 18854ee544 Polish: simplify ControllerMethodResolver initialization 2018-05-16 10:03:57 -04:00
Arjen Poutsma 7424ca5790 Improve toString for query param and path extension predicates
Issue: SPR-16829
2018-05-16 11:14:21 +02:00
Rossen Stoyanchev 3af5f00ee7 UnsupportedMediaType[Status]Exception reports body type
Issue: SPR-16805
2018-05-14 23:16:36 -04:00
Rossen Stoyanchev 395792b302 Produces media types cleared prior to error handling
Issue: SPR-16318
2018-05-14 23:16:36 -04:00
Rossen Stoyanchev 6cf6d8834c List OPTIONS in OPTIONS responses for @RequestMapping
Issue: SPR-16513
2018-05-14 09:05:03 -04:00
Rossen Stoyanchev 23001a6c3d Update WebFlux RequestPart tests
Issue: SPR-16621
2018-05-14 09:03:14 -04:00
Rossen Stoyanchev 5cee607f28 WebFlux @RequestPart support for List and Flux arguments
The resolver now supports List<T>, Flux<T>, and List<Part>.

Issue: SPR-16621
2018-05-11 18:38:29 -04:00
Rossen Stoyanchev 15182b29a4 Add MockWebSession for use with MockServerWebExchange
Issue: SPR-16772
2018-05-11 10:53:28 -04:00
Rossen Stoyanchev 7f954ebc32 Inject UriComponentsBuilder relative to webapp root
Issue: SPR-16813
2018-05-11 09:52:02 -04:00
Rossen Stoyanchev 4da43de7e1 Remove individual detection of forwarded headers
This commit removes all places where forwarded headers are checked
implicitly, on an ad-hoc basis.

ForwardedHeaderFilter is expected to be used instead providing
centralized control over using or discarding such headers.

Issue: SPR-16668
2018-05-11 09:31:39 -04:00
Rossen Stoyanchev eef592d901 Add builder to MockServerWebExchange
Issue: SPR-16772
2018-05-10 15:16:13 -04:00
Rossen Stoyanchev 1aadf2c3a6 Refine compareTo for param and header conditions
Issue: SPR-16674
2018-05-08 18:12:51 -04:00
Juergen Hoeller 53aa9cc4cd Upgrade to Servlet API 4.0.1 (aligned with Tomcat 9 and Undertow 2)
Issue: SPR-16470
2018-05-07 14:17:28 +02:00
Juergen Hoeller 48807be482 Polishing 2018-05-05 15:16:08 +02:00
Juergen Hoeller c9f488363d Fine-tuned assertions and related polishing 2018-05-05 14:39:43 +02:00
Arjen Poutsma bfb2effddb Expose resource lookup function
This commit exposes the resource lookup function used by
`RouterFunctions.resources(String, Resource)`, so that it can be
composed upon.

Issue: SPR-16788
2018-05-04 13:36:24 +02:00
Arjen Poutsma 51325afbcc Clean up path variables after non match
This commit makes sure the nested path variables are only commited to
the attributes when all predicates match.

Issue: SPR-16692
2018-05-03 11:02:46 +02:00
Sebastien Deleuze af0cb53742 Support decoding Mono in Jaxb2XmlDecoder
Issue: SPR-16759
2018-05-02 12:10:46 +02:00
Arjen Poutsma 22edab852d Provide simple way to create ServerRequest
This commit introduces support for creating a new `ServerRequest` from
an existing instance. This is especially useful when filtering requests
in a HandlerFilterFunction.

Issue: SPR-16707
2018-05-02 10:54:00 +02:00
Rossen Stoyanchev 64b8b6e978 Polish WebSocketIntegrationTests 2018-05-01 14:26:21 -04:00
Rossen Stoyanchev 725d685799 ReactorNettyWebSocketSession implements close properly
Issue: SPR-16774
2018-05-01 12:04:37 -04:00
Sam Brannen de4b65a0f3 Suppress warnings in RequestMappingMessageConversionIntegrationTests 2018-04-30 12:05:34 +01:00
Juergen Hoeller 9bff5b48cf Fine-tuned assertions and related polishing in WebFlux builders 2018-04-27 23:36:58 +02:00
Johnny Lim 6519e7b22a Polish 2018-04-27 14:06:48 -04:00
Juergen Hoeller a683472daa Support for non-standard HTTP status in reactive ClientHttpResponse
Issue: SPR-16748
2018-04-27 18:25:11 +02:00
Johannes Edmeier 2a0540cb5f Move init of excchangeStrategies to default ctor in DefaultWebClientBuilder
When the copy constructor is used the exchangeStrategies need not to be
initialized as they are set in the copyconstructor

fixes SPR-16771
2018-04-26 10:28:38 +02:00
sdeleuze 1d6540b1c2 Enable KotlinScriptTemplateTests after KT-18833 fix 2018-04-23 14:49:22 +02:00
Rossen Stoyanchev b6da63aeb7 Align with 5.0.x change #cd3ed7 2018-04-19 13:50:55 -04:00
Rossen Stoyanchev da98ff72d2 Use StringDecoder to split SSE stream
ServerSentEventHttpMessageReader had logic to split on new lines
and buffer until an empty new line (start of a new event). To account
for random data chunking, it later re-assembled the lines for each
event and split again on new lines. However bufferUntil was still
unreliable a chunk may contain nothing but a newline, which doesn't
necessarily mean an empty newline in the overall SSE stream.

This commit simplifies the above by delegating the splitting of the
stream along newlines to StringDecoder.

Issue: SPR-16744
2018-04-19 11:29:12 -04:00
Rossen Stoyanchev 30c98c8a1c Polish tests to use WebClient retrieve() 2018-04-19 09:39:34 -04:00
Rossen Stoyanchev 06041ea4e2 Polish (minor) in AbstractMessageReaderArgumentResolver 2018-04-17 17:58:03 -04:00
Rossen Stoyanchev babe6c59c4 Avoid creating Exception instance if not needed
Issue: SPR-16726
2018-04-17 17:58:03 -04:00
nkjackzhang 961c641973 Fix typo in javadoc
Closes gh-1791
2018-04-13 13:15:39 +02:00
Rossen Stoyanchev 5b9e7e44e0 Improve WebClient test with ParameterizedTypeReference
Issue: SPR-16715
2018-04-11 16:19:53 -04:00
Arjen Poutsma 7e2726f400 Add remoteAddress() to ServerRequest
Issue: SPR-16681
2018-04-10 11:13:45 +02:00
Juergen Hoeller 66a3a82fb3 Avoid reference to HandlerMethod class in ServerErrorException
This breaks the package dependency cycle between web.server/web.method and makes ServerErrorException more generally applicable. Includes deprecation of the plain reason constructor variant, in favor of providing a Method or MethodParameter context (which MatrixVariableMethodArgumentResolver does now).
2018-04-01 00:21:15 +02:00
Rossen Stoyanchev d9e17a62ce Refine SyncInvocableHandlerMethod error handling
Ensure the error is wrapped as ServerErrorException
2018-03-31 12:06:24 -04:00
Rossen Stoyanchev 4454ffd2b1 Replace remaining use of block operator 2018-03-31 11:18:38 -04:00
Juergen Hoeller 6393e5ce0c Consistent Ordered.LOWEST_PRECEDENCE declarations for default order 2018-03-31 00:20:44 +02:00
Juergen Hoeller d553ddc5b3 Nullability refinements (based on IntelliJ IDEA 2018.1 introspection)
Issue: SPR-15756
2018-03-29 23:50:17 +02:00
igor-suhorukov ab96bb5428 Remove redundant check 2018-03-29 23:33:38 +02:00
Rossen Stoyanchev dd96c873e3 Improve docs on forwarded headers
Issue: SPR-16660
2018-03-29 16:11:01 -04:00
Juergen Hoeller 695bf2961f Consistent trace logging in PathResourceResolver
Issue: SPR-16616
2018-03-29 16:04:33 +02:00
igor-suhorukov 4aae6a6dda Use Map.forEach instead of manual Map.Entry iteration wherever possible SPR-16646 2018-03-28 01:09:03 +02:00
Rossen Stoyanchev 224d52e032 Refine RequestedContentTypeResolver contract
Consistently return "*/*" if no media types were requested rather than
an empty list. Existing code has to check for both in any case to see
if nothing was requested.

Issue: SPR-16624
2018-03-27 16:54:25 -04:00
Juergen Hoeller 9a27bc9b3e Upgrade to Jackson 2.9.5 and Hibernate Validator 6.0.9 2018-03-27 17:33:34 +02:00
Juergen Hoeller 98ad23bef8 Consistent logging of encoded path evaluation failure
Issue: SPR-16616
2018-03-27 17:04:59 +02:00
Juergen Hoeller 13356a7ee2 Consistent encoded path evaluation in reactive ResourceWebHandler and co
Issue: SPR-16616
2018-03-27 01:00:42 +02:00
Juergen Hoeller e3d0ef6015 Use Map.forEach instead of manual Map.Entry iteration wherever possible
Issue: SPR-16646
2018-03-27 00:38:32 +02:00
Rossen Stoyanchev 729d0d2796 Property handling of Void.class in WebClient retrieve()
Issue: SPR-16636
2018-03-23 22:21:06 -04:00
Arjen Poutsma c56317928f Add formData() and multipartData() to ServerRequest
Issue: SPR-16551
2018-03-23 10:00:30 +01:00
Christoph Dreis d3a0a8e007 Use Collection.removeIf() where possible (#1747)
Use Collection.removeIf() where possible

Issue: SPR-16622
2018-03-22 11:36:11 +01:00
Rossen Stoyanchev 94c525cdc8 Polish @RequestPart support 2018-03-21 18:26:13 -04:00
Juergen Hoeller ba5ef6456f WebFluxResponseStatusExceptionHandler for @ResponseStatus introspection
The web.server package is quite low-level and should not depend on web.bind in order to avoid a dependency cycle. Extracting the introspection of the ResponseStatus annotation into a WebFlux-level subclass resolves the cycle.

Issue: SPR-16567
2018-03-21 16:12:32 +01:00
Rossen Stoyanchev 0e28bee0f1 Clean duplicate separators in resource URLs
Most Servlet containers do this anyway, but not all, and not
consistently for forward and backslashes.

Issue: SPR-16616
2018-03-19 17:16:03 -04:00
Rossen Stoyanchev 313c6cef32 Polish 2018-03-16 16:18:05 -04:00
Arjen Poutsma b31d55dfce Deprecated ClientRequest.method in favor of ClientRequest.create
The former method clashed with the ClientRequest.method() getter.
2018-03-16 17:27:29 +01:00
Arjen Poutsma 04c2a2990d Provide simple way to create ClientResponse
This commit introduces ClientResponse.Builder, an easier way to create a
ClientResponse from an existing response, or from scratch.

Issue: SPR-16553
2018-03-16 17:27:29 +01:00
Juergen Hoeller 2096676b3f Upgrade to Apache Johnzon 1.1.7 and JRuby 9.1.16 2018-03-15 15:43:45 +01:00
Juergen Hoeller d4a8f76bf9 Consistent volatile access to running flag in Lifecycle implementations
Issue: SPR-16488
2018-03-15 15:17:55 +01:00
Juergen Hoeller 58011f71e9 Consistent assertions for template method result vs servlet registration 2018-03-14 18:55:50 +01:00
Sam Brannen 2575c26020 Clean up warnings and dead code in spring-webflux module 2018-03-11 13:44:27 +01:00
Juergen Hoeller 2a3f90dc7b Upgrade to Hibernate ORM 5.2.15 and Hibernate Validator 6.0.8 2018-03-09 09:40:12 +01:00
igor-suhorukov d89f9af22d parentheses should be removed from a single lambda input parameter when its type is inferred 2018-03-08 21:55:45 +01:00
igor-suhorukov 0c45c4c6a3 lamdbas containing only one statement should not nest this statement in a block 2018-03-08 21:49:04 +01:00
Juergen Hoeller 139dc1d373 Polishing (collapsed if checks, consistent downcasts, refined javadoc) 2018-03-08 18:11:57 +01:00
igor-suhorukov 0f7485b01d Polish: reorder the modifiers to comply with the Java Language Specification. 2018-03-08 17:57:47 +01:00
Rossen Stoyanchev 27815847b1 content-length support in EncoderHttpMessageWriter
EncoderHttpMessageWriter checks explicitly for Mono publishers and sets
the content length, if it is known for the given data item.

Issue: SPR-16542
2018-03-06 19:04:02 -05:00
igor-suhorukov 129530f792 Polish
Closes gh-1715
2018-03-03 12:12:15 +01:00
Rossen Stoyanchev 9352e3d047 Add ClientRequest attribute for URI template
Issue: SPR-16537
2018-03-01 17:06:24 -05:00
igor-suhorukov 83300c4b27 Polish: follow naming convention 2018-03-01 00:22:29 +01:00
igor-suhorukov 8080f56db8 Polish: "@Override" should be used on overriding and implementing methods 2018-03-01 00:15:18 +01:00
igor-suhorukov 7bce04c06c Polish: combine catches block with same body 2018-02-27 12:51:28 +01:00
igor-suhorukov 49fd724d8f Polish: String function use should be optimized for single characters 2018-02-25 20:48:47 +01:00
Rossen Stoyanchev 9c55dd5961 Additional shortcut with charset in WebSocketMessage 2018-02-25 14:41:13 -05:00
Juergen Hoeller 0ef9568c06 Upgrade to OkHttp 3.10 (as well as RxJava 2.1.10 and Caffeine 2.6.2) 2018-02-25 15:38:56 +01:00
Juergen Hoeller 3531c104b0 Prefer Collections.addAll call with array over Set.addAll(Arrays.asList) 2018-02-25 00:21:39 +01:00
Juergen Hoeller a5cbf5fe24 Consistent use of Collection.toArray with zero-sized array argument
Includes consistent use of ClassUtils.toClassArray (as non-null variant)

Issue: SPR-16523
2018-02-22 11:29:46 +01:00
Juergen Hoeller 0de36d2883 Consistent HttpMethod identity comparisons 2018-02-18 22:01:22 +01:00
Juergen Hoeller d7cab23e6d Consistent use of StringUtils.toStringArray
(cherry picked from commit 6d11b40)
2018-02-16 20:49:17 +01:00
Juergen Hoeller 8d3264f680 Prefer List.sort(Comparator) over Collections.sort(List, Comparator) 2018-02-16 10:23:18 +01:00
Andy Wilkinson 52dfc4ebc4 Align spring-webflux's Webjars Locator dependency with spring-webmvc 2018-02-15 00:58:17 +01:00
igor-suhorukov 7826567df6 Polish: lamdbas containing only one statement should not nest this statement in a block 2018-02-14 01:22:01 +01:00
Juergen Hoeller 99662bc702 Polishing 2018-02-13 23:32:10 +01:00
igor-suhorukov 45e520ed86 Polish: remove unused private fields, remove empty operator 2018-02-13 23:00:18 +01:00
Rossen Stoyanchev 1908080d5c Test for disconnected client detection
Issue: SPR-16494
2018-02-13 14:58:10 -05:00
Rossen Stoyanchev 73095955bf Refine logging in ExchangeFunctions
Notably do not log error signal since we are letting that propagate.

Also improve logging messages vs relying on the log operator.

Issue: SPR-16484
2018-02-12 15:56:04 -05:00
igor-suhorukov 0ee505b73e Polish: assertion arguments should be passed in the correct order,
use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
2018-02-10 17:17:28 +01:00
igor-suhorukov 6ea0af3540 Polish: Lambdas should be replaced with method references 2018-02-10 12:09:46 +01:00
Stephane Nicoll 991eb4858e Update copyright header 2018-02-09 10:16:58 +01:00
igor-suhorukov e381514b07 Collection.isEmpty() should be used to test for emptiness
Closes gh-1670
2018-02-09 10:11:44 +01:00
igor-suhorukov 4c888d0f32 Polish
Closes gh-1669
2018-02-09 10:10:05 +01:00
Rossen Stoyanchev 1653a32a04 Stabilize Flux.interval emissions in integration tests
After this commit the use of interval in tests is combined with
take(n).onBackpressureBuffer(n) to ensure emissions don't fail if the
fixed rate is exceeded (e.g. on slow CI server).

Tests that verify N number of items followed by verifyOnComplete()
should set the number of emissions to N.

Tests that verify N number of items followed by thenCancel() should
set the number of buffered to an arbitrary number greater than N.
2018-02-06 11:01:19 -05:00
Arjen Poutsma 609f173ebc StringDecoder shouldn't chop off strings randomly
Issue: SPR-16337
2018-02-02 15:59:21 +01:00
Juergen Hoeller c5a33d62dd TypeVariablesVariableResolver compares variables by full equality again
Issue: SPR-16456
2018-02-02 12:41:43 +01:00
Juergen Hoeller 7f96827ade Polishing 2018-02-02 11:34:03 +01:00
sdeleuze b6c78452b2 Update and improve script templating documentation
Issue: SPR-16447
2018-01-31 17:57:41 +01:00
sdeleuze b2681e1f4a Add ViewResolverRegistry#scriptTemplate in WebFlux
Issue: SPR-16431
2018-01-31 10:38:08 +01:00
sdeleuze d02e4fb545 Add Vary:Access-Control-Request-Method/Headers CORS headers
This commit adds these 2 Vary headers in addition to the existing
Origin one to avoid caching of Access-Control-Request-Method and
Access-Control-Request-Headers headers which can be an issue
when allowed methods or headers are unbounded and only the
requested method or headers are returned in the response.

Issue: SPR-16413
2018-01-30 17:00:32 +01:00
sdeleuze 32f6ccece8 Add WebFlux support for Smile streaming
The commit brings following changes:
 - Move getDecodableMimeTypes() to AbstractJackson2Decoder
 - Move getEncodableMimeTypes() to AbstractJackson2Encoder
 - Add support for application/stream+x-jackson-smile
 - Avoid streaming line separator when Smile encoder is used
 - Use double null token in Jackson2Tokenizer to identify documents

Issue: SPR-16151
2018-01-29 18:56:25 +01:00
Rossen Stoyanchev 00b95b10a8 Docs: result handling and view resolution
Issue: SPR-16393
2018-01-26 22:14:14 -05:00
Rossen Stoyanchev fbde97f302 Default order 0 for ServerResponseResultHandler
Issue: SPR-16420
2018-01-26 17:06:01 -05:00
Juergen Hoeller 91e6274b7d Upgrade to Apache HttpClient 4.5.5 and Tomcat 8.5.27 2018-01-22 22:11:00 +01:00
Juergen Hoeller 61579ffe7b Polishing 2018-01-22 21:34:44 +01:00
Juergen Hoeller 9d0e62ef68 Javadoc format and related polishing 2018-01-22 11:43:21 +01:00
Arjen Poutsma 0befc60c8f Renamed DataBufferUtils/DataBufferFactory.compose to join
Issue: SPR-16365
2018-01-22 10:51:07 +01:00
Arjen Poutsma c53c8bfc5a Set 304 status on ServerResponse when ETag/LastModified match
This commit checks the Etag/LastModified headers on the incoming
request, and sets a 304 Not Modified status with no body when they
match, by delegating to ServerWebExchange.checkNotModified.

Issue: SPR-16348
2018-01-18 11:34:38 +01:00
Arjen Poutsma c211e3998b Polishing 2018-01-18 11:34:38 +01:00
Arjen Poutsma 61d330f805 Javadoc 2018-01-18 11:34:38 +01:00
Juergen Hoeller ea5f8f5a7c Consistently handle NoClassDefFoundError in BeanUtils and related places
Issue: SPR-16369
2018-01-17 20:24:57 +01:00
Juergen Hoeller 9623cdec48 Functional response builders allow for non-standard HTTP status codes
Issue: SPR-16366
2018-01-14 17:45:58 +01:00
Juergen Hoeller 4c9ed0d87e Polishing 2018-01-12 18:24:00 +01:00
Arjen Poutsma 67e7c784e8 Use DataBufferUtils.compose and remove writeAggregator
Use DataBufferUtils.compose instead of writeAggregator to combine
multiple data buffers into one, as the write aggregator would not work
when the initial data buffer did not have enough capacity to contain
all subsequent buffers.

Removed writeAggregator, as it is no longer needed.

Issue: SPR-16365
2018-01-12 10:36:09 +01:00
Rossen Stoyanchev 84b8ceca0f Update Javadoc for AbstractHandlerMapping properties
Clarify what PathPatternParser is used for which is CORS checks in the
very least. Some sub-classes will also use it for request mapping but
not all (e.g. RouterFunctionMapping). Hence the need to be more
explicit.
2018-01-11 12:41:04 -05:00
Rossen Stoyanchev 72e3c43375 Refine @EnableWebFlux docs for functional endpoints
@EnableWebFlux bootstraps both annotated controllers and functional
endpoints, so we need to be more explicit about which parts of the
configuration apply to which.

Issue: SPR-16360
2018-01-11 12:25:42 -05:00
Arjen Poutsma f7bf6460aa Reverted signature change on fromMultipartData
Reverted back from `MultiValueMap<String, Object>` to
`MultiValueMap<String, ?>`
2018-01-10 17:54:51 +01:00
Rossen Stoyanchev b36af8a11f Uncomment test after Reactor Netty fix
Issue: SPR-16246
2018-01-10 10:47:36 -05:00
Arjen Poutsma 8a129ef3da Use write aggregator from DataBufferUtils
This commit uses the newly introduced write aggregator from
DataBufferUtils throughout WebFlux.

Issue: SPR-16351
2018-01-10 11:15:47 +01:00
Rossen Stoyanchev 30c0616384 Improve error message
Issue: SPR-16214
2018-01-08 21:30:41 -05:00
Rossen Stoyanchev 446e7ed25c Links from @RequestMapping to reference docs
Issue: SPR-16266
2018-01-08 09:29:52 -05:00
Rossen Stoyanchev 93a522f336 Fix regression in BodyInserters with multipart data
The issue was introduced very recently with commit #7035ee but never
released.

Issue: SPR-16350
2018-01-05 13:59:14 -05:00
sdeleuze deac8e556e Improve Kotlin extensions doc about type erasure
Since type erasure can be fixed only when using
ParameterizedTypeReference based Java methods, RestOperations and
WebFlux API documentation should be updated to specify which extensions
are subject to type erasure, and which are not.

Issue: SPR-16273
2017-12-27 17:49:18 +01:00
Rossen Stoyanchev f389f66270 Upgrade to Reactor Bismuth snapshots
This allows us to confirm 0.7.3 fixes and run tests against the latest
ahead of an upgrade to Reactor Netty 0.8 snapshots.

The fix for #231 and #240 are confirmed but unfortunately test case for
2017-12-22 12:50:18 -05:00
Arjen Poutsma 7035ee7ebb Support Publishers for multipart data in BodyInserters
This commit uses the changes in the previous commit to support
Publishers as parts for multipart data.

Issue: SPR-16307
2017-12-21 17:41:01 +01:00
Juergen Hoeller 9d27e86951 Upgrade to Hibernate Validator 6.0.7 2017-12-21 17:00:06 +01:00
sdeleuze 99cbfd32c3 Set default view content-type with WebFlux fn
With this commit, the default content-type defined by the
view (usually "text/html;charset=UTF-8" defined in AbstractView)
is used if any, when none is defined in the response headers.

Issue: SPR-16247
2017-12-19 11:11:40 +01:00
Juergen Hoeller 3a51b5a9d2 Upgrade to Hibernate Validator 6.0.6 2017-12-15 15:58:12 +01:00
Rossen Stoyanchev f05175586e Refine behavior on error after response committed
If the response is set and we can't change the status through
ServerHttpResponse any more, allow the error signal to propagate and
let the individual server adapters handle it. Ultimately that should
result in closing the connection.

On Servlet containers, we check one last time if the response is
committed (we may not have filled the buffer). If not then save
the exception as a request attribute, dispatch, and re-throw it on the
container thread.

On Undertow access the connection and close it.

On Netty just let the error through to Reactor Netty.

Issue: SPR-16051
2017-12-12 14:51:24 -05:00
Rossen Stoyanchev fda08852ba Take content-type from ResponseEntity unconditionally
From #9a894a we began using the content-type from the ResponseEntity
but cross-checking it still against the requested content type.

Arguably there isn't any purpose in cross-checking. The only possible
outcomes are: a) it's compatible or b) it's not, which would result in
406 (NOT_ACCEPTABLE). As we've been given explicitly the media type to
use, it makes little sense to send 406, ignoring the wish to use that
content type.

Issue: SPR-16251
2017-12-02 00:43:43 -05:00
Rossen Stoyanchev 91d3e4402f Add test case for SPR-16246 2017-12-01 15:40:35 -05:00
Rossen Stoyanchev 44c95a4736 Adjust logging to catch sporadic PERF build failure 2017-12-01 10:11:51 -05:00
Rossen Stoyanchev 3650ecc3bb Polish 2017-11-28 22:16:07 -05:00
Juergen Hoeller a8323f6a27 Latest dependency updates (OkHttp 3.9.1, JRuby 9.1.14, Rome 1.9) 2017-11-26 16:03:48 +01:00
Rossen Stoyanchev 01a82b5291 Improve semantics writing currentData
Before this commit, the return value from write was interpreted as the
data being fully written and ready to be released via releaseData().

This is not true for WebSocketSession implementations where a true
return value simply means the message was sent with the full payload
but releas is not appropriate until a send confirmation.

Technically not an issue since WebSocketSession's extending this do
not use pooled buffers. Nevertheless this commit refines the semantics
of write, removes the releaseData() method, and makes sub-classes
responsible for releasing the buffer when fully written (and they
know best when that is). As a bonus currentData is now private.

Issue: SPR-16207
2017-11-23 10:55:03 -05:00
Rossen Stoyanchev c1b191edb0 Polish and improve logging 2017-11-22 23:25:36 -05:00
Rossen Stoyanchev f44366877c Switch to suspended mode before demand
After this commit, Tomcat and Undertow WebSocketSession imlpementations
start out in suspended mode and wait for demand.

The JettyWebSocketSession is capable of suspending but it doesn't seem
to work if invoked before any messages are received. That may become an
issue if there is a case where no demand appears long enough for more
messages to accumulate than we can hold.

UnderowServerHttpRequest would ideally also start in suspended mode but
that also doesn't work. It is not an issue in this case since we can
ignore the read notifications.

Servlet API requires a proactive check before it calls you back so
there is no need to suspend.

Issue: SPR-16207
2017-11-22 17:55:20 -05:00
Rossen Stoyanchev afdca285e5 Avoid resume-suspend race condition
This commit turns suspendReading() into a readingPaused() notification
that is invoked after a succession of reads stops because there is no
more demand. Sub-classes can use this notification to suspend, if that
applies to them.

Most importantly the notification is guaranteed not to overlap with
checkOnDataAvailable() which means that suspend does not need to be
atomic and guarded against resume. The two can and do compete all the
time when reading ends with no demand, and a request for demand arrives
concurrently.

Issue: SPR-16207
2017-11-22 17:48:03 -05:00
sdeleuze 652e5c5584 Disable CORS credentials by default
Access-Control-Allow-Credentials CORS header, used to
allow cookies with CORS requests, is not set to true
anymore by default when enabling CORS with
@CrossOrigin or global CORS configuration in order to
provide a more secured default CORS configuration.

The related allowCredentials property now requires to
be set to true explicitly in order to support cookies
with CORS requests.

Issue: SPR-16130
2017-11-22 22:46:44 +01:00
Rossen Stoyanchev b7c924cac1 Polish 2017-11-21 23:20:13 -05:00
Violeta Georgieva d8099adc9a AbstractListenerWebSocketSession: suspend the channel when there is no demand
Issues: SPR-16207
2017-11-21 22:59:33 -05:00
Rossen Stoyanchev b89a48a703 Improve FlushingIntegrationTests 2017-11-21 22:12:33 -05:00
sdeleuze 9f1d8517ba Polish Kotlin source code style 2017-11-21 15:59:23 +01:00
Rossen Stoyanchev bc8e525e60 Add shared instance of ReactiveAdapterRegistry
Issue: SPR-16218
2017-11-20 17:02:22 -05:00
Juergen Hoeller 14a7da8183 Upgrade to Hibernate Validator 6.0.5 2017-11-19 21:16:10 +01:00
Rossen Stoyanchev ce895d7a84 Add mention of shortcut methods in BodyInserters 2017-11-17 10:43:53 -05:00
sdeleuze c530745015 Fix JsonView + HttpEntity Reactive handling
This commit adds
AbstractMessageReaderArgumentResolver#readBody and
AbstractMessageWriterResultHandler#writeBody variants
which allow to pass the actual MethodParameter in order
to perform proper annotation-based hint resolution with
nested generics, for example with HttpEntity.

Issue: SPR-16098
2017-11-16 15:12:58 +01:00
Rossen Stoyanchev 8e21023f28 Update docs on ClientResponse
Issue: SPR-16200
2017-11-15 17:08:57 -08:00
Rossen Stoyanchev 6e05a5881e Update WebClient Javadoc
Issue: SPR-16197
2017-11-15 15:09:01 -08:00
sdeleuze 9dd29f76ae Polish CORS documentation 2017-11-15 16:16:13 +01:00
Rossen Stoyanchev fb7b7d089b Revert erroneously committed change 2017-11-14 08:42:04 -05:00
Rossen Stoyanchev 536e72c8df Add WebSocket chapter to WebFlux section
Issue: SPR-15700
2017-11-13 23:20:01 -05:00
Rossen Stoyanchev 5e86049438 Expose WebSocket options for Tomcat/Jetty 2017-11-13 23:20:01 -05:00
Rossen Stoyanchev e818b904ad Polish WebSocket-related 2017-11-13 23:20:01 -05:00
Rossen Stoyanchev 9a894ab61e Use ResponseEntity Content-Type as producible media type
Issue: SPR-16172
2017-11-10 15:05:03 -05:00
Rossen Stoyanchev f565f635e3 Polish 2017-11-10 11:29:58 -05:00
Rossen Stoyanchev ff97eafa4f Fix NPE in ErrorsArgumentResolver
Issue: SPR-16187
2017-11-10 10:57:26 -05:00
Rossen Stoyanchev a5103307c6 Polish ErrorArgumentResolver 2017-11-10 10:15:46 -05:00
Rossen Stoyanchev 8cfa3c632b Allow Undertow client in websocket integration tests
It seems to work.
2017-11-09 17:49:11 -05:00
Rossen Stoyanchev cb34b0b963 Polish 2017-11-09 17:16:31 -05:00
anton_bondarenko b487db294b Fix NullPointer when setting cookies in RequestUriSpec 2017-11-09 16:59:44 -05:00
Rossen Stoyanchev 807297f173 Remove RxNetty (from test sources)
Practically no changes to RxNetty for a year and efforts underway to
rebuild 0.6.x based on a current Reactor Netty base.

Aside from the extra time to run integration tests having two
Netty-based servers can also cause false alarms such as ByteBuf leaks
related to RxNetty.
2017-11-09 15:56:56 -05:00
Arjen Poutsma db00669197 Allow to set cookies in ServerResponse
Issue: SPR-16121
2017-11-09 11:04:02 +01:00
Rossen Stoyanchev 9786750b5a Improve @RequestAttribute WebFlux resolver
The resolver now takes into account the possibility the attribute
itself may be a reactive type.

Issue: SPR-16158
2017-11-06 21:44:45 -05:00
Rossen Stoyanchev 14f02d7192 Update reference with examples of multipart requests
Issue: SPR-16118
2017-11-06 16:33:58 -05:00
Arjen Poutsma af2e296ff3 Javadoc 2017-11-06 16:00:18 +01:00
Rossen Stoyanchev 8c33ed02b3 ServletHttpHandlerAdapter supports Serlvet path mapping
Issue: SPR-16155
2017-11-02 20:53:26 -04:00
Rossen Stoyanchev aa653b23bc Add AbstractReactiveWebInitializer
This commit introduces a new AbstractReactiveWebInitializer in
spring-web that relies on WebHttpHandlerBuilder to detect request
processing infrastructure beans from an ApplicationContext.

This eliminates the need to create a DispatcherHandler, since it is
expected to be a Spring bean, and as a result the initializers in
spring-webflux have been deprecated.

Issue: SPR-16144
2017-11-02 14:57:06 -04:00
Arjen Poutsma a58002a5de Chained API for form and multipart data in BodyInserters
Issue: SPR-16133
2017-11-01 13:17:52 +01:00
Rossen Stoyanchev 48c2cc18b9 Update form + multipart data Javadoc on BodyInserters
Issue: SPR-16118
2017-10-31 09:21:09 -04:00
Rossen Stoyanchev 8083eaae54 syncBody better differentiates plain vs multipart forms
FromHttpMessageWriter and MultipartHttpMessageWriter both support
MultiValueMap except the former supports String values only. This
presents an issue since either full generic type information must be
provided, which is cumbersome on the client side, or if left out there
is no good way to order the writers to make a proper decision.

This commit:

- refines the canWrite behavior of   to not a
accept MultiValueMap without proper generic information unless the
MediaType is explicitly set providing a strong hint.

- modifies MultipartHttpMessageWriter to be configured with a
FormHttpMessageWriter so it can write both plan and multipart data with
the ability to properly differentiate based on actual map values.

Issue: SPR-16131
2017-10-31 09:12:05 -04:00
Juergen Hoeller e5c8dc0d65 MessageSource.getMessage returns null default message as-is (again)
Issue: SPR-16127
2017-10-31 11:06:42 +01:00
Juergen Hoeller 9bab7a2708 Upgrade to Java Activation Framework 1.2 for test runtime
Includes upgrade to Hibernate Validator 6.0.4 (where applicable)

Issue: SPR-16115
2017-10-25 19:18:10 +02:00
Arjen Poutsma 6457a1556e Javadoc 2017-10-24 10:59:47 +02:00
Arjen Poutsma 40a6fba443 Allow to change URL/method in ClientRequest.Builder
This commit exposes the ClientRequest's URL and HttpMethod fields via a
setter, so that they can be changed more easily in a request that was
created via ClientRequest.from(ClientRequest).

Issue: SPR-16093
2017-10-23 16:39:33 +02:00
Rossen Stoyanchev 1cc5afe24b Fix lines over 120 characters
https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Code-Style#line-wrapping
2017-10-20 16:42:26 -04:00
Juergen Hoeller e17ad551f3 Latest dependency updates (RxJava 1.3.3, Hibernate ORM 5.2.12, Hibernate Validator 5.4.2 & 6.0.3) 2017-10-20 16:16:06 +02:00
Juergen Hoeller d1fac36e3e SchedulingConfigurer and JmsListenerConfigurer respect @Order
Issue: SPR-16090
2017-10-20 16:10:12 +02:00
Rossen Stoyanchev 48eb416ecc Fix failing tests 2017-10-19 21:42:31 -04:00
Rossen Stoyanchev ab92754a2e @MatrixVariable resolvers for WebFlux
The information was already parsed and available in a request attribute
but until now there were no argument resolvers to expose it.

Issue: SPR-16005
2017-10-19 21:01:38 -04:00
Rossen Stoyanchev d8a7b96b46 WebFlux support for "request handled" in controller
Issue: SPR-16087
2017-10-18 21:07:27 -04:00
Rossen Stoyanchev 950edf888a Support for Map method argument in WebFlux
Issue: SPR-16086
2017-10-18 11:41:46 -04:00
Rossen Stoyanchev 32d78e60b6 Update information on WebApplicationContext hierarchy
Issue: SPR-16041
2017-10-17 21:49:57 -04:00
Rossen Stoyanchev 94c4a7f941 Shortcut factory method in MockServerWebExchange
MockServerWebExchange now has a second factory method that accepts a
MockServerHttpRequest.BaseBuilder.

Issue: SPR-16079
2017-10-17 12:23:12 -04:00
Juergen Hoeller 3890d4c9eb AbstractServerHttpResponse stores HTTP status code as integer value
Issue: SPR-16073
2017-10-16 15:34:09 +02:00
Arjen Poutsma faa74988c4 WebClient.mutate() should not impact future .mutate() invocations
Before this commit, when adding filters to a builder obtained via
`WebClient.mutate()`, the filters were added both to the original client
as well as the mutated builder. This commit fixes that.

Issue: SPR-16059
2017-10-13 11:23:10 +02:00
Brian Clozel 3febec3df6 ResourceWebHandler signals error for missing resources
Prior to this commit, the `ResourceWebHandler` would itself handle the
response with an HTTP 404 in many cases, including a missing static
resource.

This does not give a chance to `WebExceptionHandler` instances to handle
that error and, for example, display an error page.

See spring-projects/spring-boot#8625

Issue: SPR-16023
2017-10-10 23:28:03 +02:00
Rossen Stoyanchev 48c41049b1 Correct package for MockServerWebExchange
Discovered late, but not too late. MockServerWebExchange is now in the
proper package matching to the location of ServerWebExchange.
2017-09-29 17:03:23 -04:00
Rossen Stoyanchev 223e27d53d Package private request and response implementations
Concrete server and client, reactive request and response
implementations should not have to be accessed outside their package.
They could be seen as private to their HttpHandler adapters and
ClientHttpConnector's respectively.

The one exception, WebSocket upgrades in spring-webflux, is an internal
framework use case, accommodated via downcast + accessors in the
abstract base classes.
2017-09-29 13:04:03 -04:00
Arjen Poutsma 69945f4185 WebClient throws ClassCastException for bodyToMono(ParameterizedTypeReference)
Prior to this commit, the `WebClient` always throws a `ClassCastException`
when an error occurs in `bodyToMono(ParameterizedTypeReference)``, and
not the expected exception, as set up by `onStatus`

Issue: SPR-16025
2017-09-29 10:15:40 +02:00
Rossen Stoyanchev d332e06f6c Update reference after removal of ClientResponse.close() 2017-09-28 16:11:48 -04:00
Rossen Stoyanchev 869b818e96 WebFlux support for LocaleContext related arguments
Issue: SPR-15998
2017-09-27 22:03:42 -04:00
Brian Clozel 126ac849e5 Fix behavior of ClientResponse#bodyTo** with Void
Prior to this commit, asking for a `Void` type using any of the
`ClientResponse#bodyTo*` methods would immediately return an empty
`Publisher` without consuming the response body.

Not doing so can lead to HTTP connection pool inconsistencies and/or
memory leaks, since:

* a connection that still has a response body being written to it cannot
be properly recycled in the connection pool
* incoming `DataBuffer` might not be released

This commit detects when `Void` types are asked as body types and in
those cases does the following:

1. Subscribe to the response body `Publisher` to allow the connection to
be returned to the connection pool
2. `cancel()` the body `Publisher` if the response body is not empty; in
that case, we choose to close the connection vs. consume the whole
response body

Those changes imply that `ClientHttpResponse` and other related
contracts don't need a `close()` method anymore.

Issue: SPR-16018
2017-09-28 00:58:38 +02:00
Juergen Hoeller ec345bf162 Revised handling of missing data class arguments
Includes unified detection of Kotlin's optional parameters in MethodParameter.isOptional(), reduces BeanUtils.findPrimaryConstructor to Kotlin semantics (for reuse in AutowiredAnnotationBeanPostProcessor), and finally introduces a common KotlinDetector delegate with an isKotlinType(Class) check.

Issue: SPR-15877
Issue: SPR-16020
2017-09-28 00:31:12 +02:00
Rossen Stoyanchev 6ee1af27c6 WebFlux supports HTTP HEAD
Issue: SPR-15994
2017-09-27 15:25:29 -04:00
Brian Clozel 10139d42fc Revisit meaning of response.close() in HTTP client
Prior to this issue, SPR-15920 added this new `close()` method which was
supposed to be called to clean resources after response processing.

This commit changes the meaning of that method: calling `close()` will
close the underlying HTTP connection. This has to be called if the
response body is not consumed by the application, since at that point
the underlying connection might be in an inconsistent state if shared in
a connection pool.

Issue: SPR-15993
2017-09-27 14:03:55 +02:00
Rossen Stoyanchev 41b53de644 DispatcherHandler.getHandlerMappings() is also final
Issue: SPR-15934
2017-09-26 15:35:17 -04:00
Sebastien Deleuze 14cba15296 Open router and bean Kotlin DSL to allow building custom ones 2017-09-26 16:31:16 +02:00
Brian Clozel 80979e7592 Polish 2017-09-26 11:00:34 +02:00
Brian Clozel 3d37c889fa Un-ignore RequestMapping test for handling "" paths
Issue: SPR-15653
2017-09-26 10:59:21 +02:00
Rossen Stoyanchev bdde0f1ea0 WebFlux supports UriBuilder, UriComponentsBuilder args
Issue: SPR-15997
2017-09-25 16:41:30 -04:00
Rossen Stoyanchev 2da2c17fbb WebFlux supporst HttpHeaders return values
Issue: SPR-16006
2017-09-25 16:09:28 -04:00
Arjen Poutsma 1a3cc3df94 Moved fromServerRequest to ServerRequest itself
This commit moves WebFluxUriComponentsBuilder.fromServerRequest to the
ServerRequest interface itself.

Consequently, the WebFluxUriComponentsBuilder is removes itself, as it
contained no other methods.

Issue: SPR-15953
2017-09-25 11:29:07 +02:00
Juergen Hoeller e2882fe1db Build against EE 8 API level wherever possible
Upgrade to JAXB 2.3, JAX-WS 2.3, Annotations 1.3.1, Interceptor 1.2.1.
Also includes Log4J 2.9.1 and Asciidoctor 1.5.6.
2017-09-24 17:18:21 +02:00
Juergen Hoeller 9190b76ab9 Latest dependency updates (POI 3.17, Rome 1.8, EhCache 3.4, Caffeine 2.5.6, RxJava 2.1.4, Tomcat 8.5.21, JRuby 9.1.13, Rhino 1.7.7.2) 2017-09-23 11:28:19 +02:00
Rossen Stoyanchev ed10cab9d3 Remove DispatcherHandler static factory methods
The typical way to load DispatcherHandler is to use
WebHttpHandlerBuilder#applicationContext which also detecs filters,
exception handlers, as well as other beans that are injected into every
ServerWebExchange -- custom session manager, localecontext resolver,
codecs for form data, multipart data, etc

WebHttpHandlerBuilder is the preferred and way so removing the ones on
DispatcherHandler. They could always be added back later.
2017-09-22 16:24:39 -04:00
Rossen Stoyanchev c28a6357c5 DispatcherHandler alignment with DispatcherServlet
Issue: SPR-15934
2017-09-22 15:44:12 -04:00
Rossen Stoyanchev 816a58fcf9 RouterFunctionMapping provides getter for RouterFunction
Issue: SPR-15991
2017-09-22 15:15:41 -04:00
Rossen Stoyanchev 31619b3ffb DispatcherHandler orders HandlerMappings correctly again
Issue: SPR-15991
2017-09-22 15:06:23 -04:00
Juergen Hoeller 7ae59d0c2a Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
2017-09-22 18:22:14 +02:00
Arjen Poutsma 4fbf86e5ce Javadoc 2017-09-22 14:17:51 +02:00
Arjen Poutsma 2841ef5d05 Introduce RouterFunction visitor
This commit introduces a visitor for router functions
(RouterFunctions.Visitor), allowing to iterate over all the components
that make up a router function.

This commit also introduces a ToStringVisitor, which creates a nicely
formatted string for use with toString().

Issue: SPR-15711, SPR-15711
2017-09-22 14:03:09 +02:00
Jason Yu 78434c8e20 Release DataBuffers in FreeMarkerView
When template processing throws an exception, we must ensure that
`DataBuffers` are properly released to avoid memory leaks.

Issue: SPR-15966
2017-09-22 10:08:18 +02:00
Rossen Stoyanchev 819ca0dbd4 Expose getters for the configured HandlerMapping's
Issue: SPR-15934
2017-09-21 09:46:26 -04:00
Arjen Poutsma a7617a2641 Introduce WebFluxUriComponentsBuilder
This commit introduces the WebFluxUriComponentsBuilder, with a single
method that creates a UriComponentsBuilder for a ServerRequest. More
methods to be added by @rstoyanchev.

Issue: SPR-15953
2017-09-15 14:14:39 +02:00
Arjen Poutsma 2fb3eeba6f Introduce ServerRequest.methodName()
This commit introduces a methodName() method to the ServerRequest,
returning the String name of the method. This method is useful for
non-standard HTTP methods.
2017-09-15 14:14:39 +02:00
Sebastien Deleuze 1bc93e3d0f Revisit nullability annotations
This commit introduces the following changes.

1) It adds a new Spring @NonNull annotation which allows to apply
@NonNullApi semantic on a specific element, like @Nullable does.
Combined with @Nullable, it allows partial null-safety support when
package granularity is too broad.

2) @Nullable and @NonNull can apply to ElementType.TYPE_USE in order
to be used on generic type arguments (SPR-15942).

3) Annotations does not apply to ElementType.TYPE_PARAMETER anymore
since it is not supported yet (applicability for such use case is
controversial and need to be discussed).

4) @NonNullApi does not apply to ElementType.FIELD anymore since in a
lot of use cases (private, protected) it is not part for the public API
+ its usage should remain opt-in. A dedicated @NonNullFields annotation
has been added in order to set fields default to non-nullable.

5) Updated Javadoc and reference documentation.

Issue: SPR-15756
2017-09-15 13:26:41 +02:00
Brian Clozel 81125de697 Fix error responses handling in WebClient
This commit fixes a typo in the `DefaultWebClient` implementation.
Instead of forwarding resolved `WebClientException` instances as error
signals, the `bodyToMono(ParameterizedTypeReference)` variant would just
forward those exceptions as `onNext` signals.

Issue: SPR-15946
2017-09-14 14:15:05 +02:00
Brian Clozel 98b6491f0c Send error signal also for empty server responses
Prior to that commit, the `ResponseSpec` `WebClient` would process error
responses (4xx, 5xx HTTP status) and transform those into error signals
with a `WebClientResponseException`. But this would only work if the
HTTP response would have a non-empty response body.

An empty error response would not send an error signal and only
translate in an `onComplete` signal.

This commit fixes this behavior and makes sure that this error signal is
sent in all cases.

Issue: SPR-15946
2017-09-13 10:56:57 +02:00
Brian Clozel aa19912e00 Polish 2017-09-13 10:51:13 +02:00
Rossen Stoyanchev e214d69350 Remove jetbrains annotations inserted by IDE 2017-09-11 09:31:43 -04:00
Rossen Stoyanchev f76ac5bb32 WebFlux support for @SessionAttributes
Issue: SPR-15887
2017-09-09 17:40:59 -04:00
Rossen Stoyanchev bc470fca30 Polish 2017-09-09 17:40:59 -04:00
Juergen Hoeller fd0132c7e6 Polishing 2017-09-08 16:56:22 +02:00
Juergen Hoeller 496223a927 WebFlux supports field default/marker parameters for data classes as well
Issue: SPR-15871
2017-09-08 16:55:12 +02:00
Sam Brannen 15ab0ad6e2 Clean up warnings in Gradle build output 2017-09-07 12:25:10 +02:00
Brian Clozel 16f3f8d28f Add close() method on HTTP client response
Before this commit, there was no way to signal the HTTP client that we
were done consuming the response. Without that, the underlying client
library cannot know when it is safe to release the associated resources
(e.g. the HTTP connection).

This commit adds new `close()` methods on both `ClientHttpResponse`
and `ClientResponse`. This methods is non-blocking and its behavior
depends on the library, its configuration, HTTP version, etc.

At the `WebClient` level, `close()` is called automatically if we
consume the response body through the `ResponseSpec` or the
`ClientResponse` itself.

Note that it is *required* to call `close()` manually otherwise; not
doing so might create resource leaks or connection issues.

Issue: SPR-15920
2017-09-06 17:29:18 +02:00
Arjen Poutsma 02a2c400c7 Move URL transform methods from ServerHttpResponse to ServerWebExchange
This commit moves `encodeUrl` and `registerUrlEncoder` from
ServerHttpResponse to ServerWebExchange.

It also renames `encodeUrl` to `transformUrl` and `registerUrlEncoder`
to `addUrlTransformer` to make it clearer that these methods do not
perform actual URL encodings (i.e. they do not replaceinvalid
characters).
The `add` prefix (instead of `register`) makes it clearer that each
function is added in addition to the previous one.

Issue: SPR-15924
2017-09-06 14:39:09 +02:00
Rossen Stoyanchev 03eb6f76db Improve check for actual return value type
Issue: SPR-15910
2017-09-05 16:11:35 -04:00
Rossen Stoyanchev fc0841c60f Adapt to method name change in Mono 2017-09-05 13:57:20 -04:00