Commit Graph

2069 Commits

Author SHA1 Message Date
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
Sebastien Deleuze 5d4ee09d53 Fix AbstractJackson2Encoder#canEncode
This commit ensures that the Jackson encoder is selected only
with supported mime types.

Issue: SPR-15910
2017-09-06 08:26:15 +02:00
Rossen Stoyanchev 320bfdf413 Polish 2017-09-05 17:47:02 -04:00
Greg Turnquist c98e01ad1f Create session-based WebSessionIdResolver
Introduces HeaderSessionIdResolver, which reads session ids from a session header and generates a session response header when new session are created.

Related issue: SPR-15917
2017-09-05 17:37:50 -04:00
Rossen Stoyanchev fc0841c60f Adapt to method name change in Mono 2017-09-05 13:57:20 -04:00
Juergen Hoeller f0198f3756 Upgrade to Apache Johnzon 1.1.3
Issue: SPR-15590
2017-09-02 00:28:41 +02:00
Brian Clozel bff54788e8 Enable HTTP compression Reactor ClientHttpConnector
`ReactorClientHttpConnector` provides an adapter layer to `WebClient`
for using Reactor-Netty's `HttpClient`.
This commit enables HTTP compression support by default for this client
Connector.

Another constructor is still available for providing a custom
`HttpOptions` configuration.

Issue: SPR-15908
2017-09-01 23:14:58 +02:00
Rossen Stoyanchev 3d61f7ba60 Polish 2017-09-01 16:57:35 -04:00
Brian Bohl 81dfadcb16 Fix StringIndexOutOfBoundsException in RestTemplate.doExecute IOException handler when query string is an empty string 2017-09-01 16:48:53 -04:00
Juergen Hoeller 2b44e6e21c Strong references to mapped exception handler methods
Issue: SPR-15907
2017-08-29 15:07:23 +02:00
Brian Clozel 397fd24849 Revert "Leverage Kotlin plugin dependency management"
This reverts commit 3e2f6c848a.
2017-08-22 21:29:39 +02:00
Sebastien Deleuze 3e2f6c848a Leverage Kotlin plugin dependency management 2017-08-22 17:35:57 +02:00
Sebastien Deleuze 9abe77670c Sync with reactor-core when() -> zip() change 2017-08-21 19:54:08 +02:00
Brian Clozel cc3d7d2d48 Apply dependency management to selected modules
This commit applies the Dependency Management Plugin to modules that
require it; right now Spring Framework is importing BOMs for Netty and
Reactor dependencies only.

Instead of applying those BOMs to all modules, they're applied only
where they're needed.

Issue: SPR-15885
2017-08-21 14:42:03 +02:00
Brian Clozel 2eeb428e95 Move modules to independent build files
The main `build.gradle` file contains now only the common build
infrastructure; all module-specific build configurations have
been moved to their own build file.

Issue: SPR-15885
2017-08-21 14:41:55 +02:00
Juergen Hoeller b61c055e43 Polishing 2017-08-21 01:37:33 +02:00
Juergen Hoeller 3991ab4a23 Efficient Kotlin metadata detection
Issue: SPR-15673
2017-08-21 01:33:20 +02:00
Stephane Nicoll f6e7fef236 Polish 2017-08-19 10:50:41 +02:00
Juergen Hoeller 9aa369f402 Data class construction supports field default/marker parameters
Issue: SPR-15871
2017-08-18 17:59:06 +02:00
Juergen Hoeller 47a7475898 Resolve remaining nullability warnings
Issue: SPR-15869
2017-08-18 00:15:46 +02:00
Juergen Hoeller b94302b5bd Enforce non-null value from getBean and at injection points
Bean-derived null values may still get passed into bean properties and injection points but only if those are declared as non-required. Note that getBean will never return null; a manual bean.equals(null) / "null".equals(bean.toString()) check identifies expected null values now.  This will only ever happen with custom FactoryBeans or factory methods returning null - and since all common cases are handled by autowiring or bean property values in bean definitions, there should be no need to ever manually check for such a null value received from getBean.

Issue: SPR-15829
2017-08-18 00:11:35 +02:00
Sebastien Deleuze 73cf07e9a4 Fix overridden methods nullability
Issue: SPR-15869
2017-08-17 15:02:59 +02:00
Juergen Hoeller 61cdc842e0 BindingResult support for constructor argument mismatch on immutable data object
Issue: SPR-15542
2017-08-17 11:02:40 +02:00
Rossen Stoyanchev e433d8b66a Polish 2017-08-16 15:45:14 +02:00
rlindooren 5b29555d88 Jackson encoder and decoder should use provided mime types
Instead of always using the default JSON mime types
2017-08-16 15:25:18 +02:00
Rossen Stoyanchev 645e3492db Use URLDecoder for query params in WebFlux
Issue: SPR-15860
2017-08-16 13:34:31 +02:00
Rossen Stoyanchev 8b7a670821 Cancel WebAsyncManager thread on request timeout
Issue: SPR-15852
2017-08-16 09:26:21 +02:00
Rossen Stoyanchev 280c64ba35 Polish 2017-08-14 18:55:39 +03:00
Rossen Stoyanchev 8c4b1ab781 Functional PathPattern comparator 2017-08-14 16:33:39 +03:00
Rossen Stoyanchev 631b546d1c Proper null handling in PathPattern comparator 2017-08-14 11:45:27 +03:00
Juergen Hoeller adeb521ce4 Polishing 2017-08-08 17:27:28 +02:00
Stephane Maldini 2677bab560 Use Bismut-BUILD-SNAPSHOT
Sync 3.1.0.BUILD-SNAPSHOT changes to Operators.checkRequest (removed)
2017-08-03 14:30:08 -07:00
Rossen Stoyanchev 08dfce2cb5 Dedicated specificity comparator in PathPattern
The PathPattern compareTo method is now consistent with equals when
two patterns are of the same specificity but otherwise different.

Separately PathPattern now exposes a Comparator by specificity that
offers the current functionality of compareTo. This can be used for
actual sorting where we only care about specificity.
2017-08-02 18:11:36 +02:00
Rossen Stoyanchev 62fa20fd6f PathPattern#matchAndExtract minor refactoring
Consistent behavior with matches(PathContainer), the two had slightly
different logic for handling of empty paths.

Make matchAndExtract independantly usable without the need to call
matches(PathContainer) first. Essentially no longer raising ISE if the
pattern doesn't match but simply returning null.
2017-08-02 16:31:06 +02:00
Rossen Stoyanchev dccedd5ad5 Minor refactoring in PathPattern
Rename getPathRemaining to matchStartOfPath since the method does
match and to be more clear about what the method and the return value
intuitively follows.

Remove matchStart which matches the start of the pattern (rather than
the start of the path). It is a use case that does not come up in
request mapping.
2017-08-02 15:05:28 +02:00
Rossen Stoyanchev c060f4f615 Polish PathPattern and parser
Updates to Javadoc
Consistent and separator type neutral naming for trailing slash
PathPattern extracts options from the parser instance
2017-08-02 14:21:16 +02:00
Arjen Poutsma 5394cc0c63 WebClientException should allow access to status code of the response
This commit changes the WebClient so that it now throws a
`WebClientResponseException` for `ResponseSpec.bodyTo`. This newly
introduces exception contains the status code, headers, and body of the
response message.

As a consequence of the above, we had to change `onStatus` so that the
`exceptionFunction` now returns a `Mono<Throwable>` rather than a
`Throwable`, which it was before. The Mono allows for asynchronous
operations, such as reading the contents of the body.

Issue: SPR-15824
2017-08-02 10:20:58 +02:00
Rossen Stoyanchev b6d1fd9d22 Minor refactoring in PathPatternParser
Remove the separator constructor argument (but preserve internal
functionality) now that PathPatternParser is more explicitly purposed
for URL paths and in any case the use of an alternate separator would
also requires a similar input option on the PathContainer parsing side.
2017-08-01 22:52:18 +02:00
Rossen Stoyanchev 1794f1cea4 Polish path pattern parsing javadoc
Emphasize specific purpose for URL path matching.
2017-08-01 22:31:21 +02:00
Rossen Stoyanchev b1440b6816 Remove ParsingPathMatcher
Now that we also have RequestPath and PathContainer with the latter as
the required input, the ParsingPathMatcher adapter can be removed.
2017-08-01 13:35:21 +02:00
Juergen Hoeller ca0983cd85 Polishing 2017-08-01 12:08:57 +02:00
Rossen Stoyanchev f813a63fd8 PathContainer parses URL paths only
Collapse non-URL vs URL based path parsing into one essentially
supporting URL paths only.
2017-07-31 22:10:08 +02:00
Rossen Stoyanchev af83d2332a Fix regression in HttpPutFormContentFilter
Re-arrange the checks so that if there is no form parameter, then
immediately and unconditionally delegate to super.getParameterValues().
Or reversely if there is no super.getParameterValues() then return the
form parameter.

So the only remaining case is when combining values present in both.
In that case we'll take both only if a queryString exists.

One extra fix is to not even wrap the request if we did not parse any
form parameters at all which can happen with HttpHiddenMethodFilter.

Issue: SPR-15828, 15835
2017-07-31 17:30:22 +02:00
Stephane Nicoll 1a9cfefcbb Fix test failure
Issue: SPR-15548
Closes gh-1488
2017-07-31 10:45:18 +02:00
Rossen Stoyanchev dbe25cf717 Add RequestPath tests for modifying the contextPath 2017-07-28 12:26:34 +02:00
Rossen Stoyanchev 6855a85c41 Move RequestPath to parent server package 2017-07-28 12:26:34 +02:00
Sebastien Deleuze 6583f9f754 Use ParameterizedTypeReference instead of Class in Kotlin extensions
This commit also removes WebFlux non-extension functions in favor of
regular Kotlin extensions leveraging ParameterizedTypeReference parameter.

Issue: SPR-15818
2017-07-28 00:22:00 +02:00
Rossen Stoyanchev 7e232f989b Improve check for "Broken pipe" error message
Issue: SPR-15802
2017-07-25 10:30:11 +02:00
Sebastien Deleuze ed6fe2b723 Upgrade to Kotlin 1.1.4-eap-33
Issue: SPR-15814
2017-07-24 17:29:02 +02:00
Rossen Stoyanchev 14ccb38523 Handle nested w/o top-level array in Jackson2JsonTokenizer
Issue: SPR-15803
2017-07-21 13:43:38 +02:00
Rossen Stoyanchev bd0de7086e Jackson2JsonTokenizer unwraps top level array only
When the input stream is a JSON array the tokenizer skips over the
start and end array tokens in order to decode into an array of
top-level objects. However in this mode it also skips over nested
start and end array tokens which prevents proper parsing of JSR-310
dates (represented with an array syntax) as well as any fields that
are collections.

Issue: SPR-15803
2017-07-21 12:41:20 +02:00
Rossen Stoyanchev c3e3df57f8 Polish 2017-07-21 12:08:06 +02:00
Rossen Stoyanchev 3009e29489 Remove contentDispositionFormData with charset method
The method was orginally added under SPR-14547 but the example in it
was probably intended for use with Content-Disposition server response
header (file dowonload) and not for a Content-Disposition header
within the body of a multipart request.

In a Spring application a multipart request is typically serialized
by the FormHttpMessageConverter and hence the Content-Disposition is
not explicitly set by the application.

Issue: SPR-15205
2017-07-20 17:49:59 +02:00
Brian Clozel f1abcba4eb Support ipV6 Host addresses in HttpHeaders
This commit parses the "Host" HTTP request header as an
`InetSocketAddress`, while supporting IPv6 addresses like `[::1]`.

This host string contains `:` chars even though it has no port
information.

Issue: SPR-15799
2017-07-20 15:21:46 +02:00
Rossen Stoyanchev bb684ce60b Improve decoding support for multipart filename
StandardMultipartHttpServletRequest now properly decodes RFC-5987
encoded filenames (i.e. filename*) by delegating to ContentDisposition
and also support RFC-2047 syntax through javax.mail MimeUtility.

Issue: SPR-15205
2017-07-20 14:26:20 +02:00
Juergen Hoeller e4651d6b50 XmlEventDecoder uses common defensive XMLInputFactory (now in StaxUtils)
Issue: SPR-15797
2017-07-20 13:17:27 +02:00
Sebastien Deleuze fa4d139684 Support instantiating Kotlin classes with optional parameters
This commit updates BeanUtils class in order to add Kotlin optional
parameters with default values support to the immutable data classes
support introduced by SPR-15199.

Issue: SPR-15673
2017-07-20 10:44:06 +02:00
Brian Clozel 5cac619e23 Fix host+port resolution in ReactorServerHttpRequest
Prior to this commit, the host+port information of the incoming request
where taken from the remoteAddress, which is actually the socket address
of the HTTP client (i.e. not the server).

This commit resolves this information from the "Host" HTTP request
header, if available, or the actual local address of the channel if no
header is available.

Issue: SPR-15084
2017-07-20 01:45:13 +02:00
Juergen Hoeller 6d6d772f31 Polishing 2017-07-20 00:14:56 +02:00
Rossen Stoyanchev 378c72e9b6 Polish + minor refactoring of ResourceUrlProvider 2017-07-19 23:04:39 +02:00
Juergen Hoeller 13080f04f4 UriUtils.extractFileExtension properly handles all fragments
Issue: SPR-15786
2017-07-19 22:40:24 +02:00
Juergen Hoeller ac1d3b22c9 Polishing 2017-07-19 22:22:27 +02:00
Juergen Hoeller 46eba3dbfa Nullability fine-tuning around declaration inconsistencies
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 22:22:20 +02:00
Rossen Stoyanchev 68e6b148cb Refactor relative redirect filter support
Issue: SPR-15717
2017-07-19 18:46:16 +02:00
Rob Winch fadf04e4b4 Add RelativeRedirectFilter 2017-07-19 17:15:33 +02:00
Rob Winch 5f868b493a Add ForwardedHeaderFilter requestOnly
Add an option for ForwardedHeaderFilter to only process the
HttpServletRequest. This means that HttpServletResponse.sendRedirect will
only work when the application is conifgured to use relative redirects
using Servlet Container specific setup.

Issue: SPR-15717
2017-07-19 17:15:33 +02:00
Rossen Stoyanchev 147368eccc Proactively reject URLs without target address
Issue: SPR-15782
2017-07-19 12:37:32 +02:00
Rossen Stoyanchev cbe5a67687 Polish 2017-07-19 12:37:32 +02:00
Juergen Hoeller 9fc4fb10b0 Nullability fine-tuning around bean properties
Issue: SPR-15720
Issue: SPR-15792
2017-07-19 11:43:58 +02:00
Sebastien Deleuze fb4ddb0746 Make getters and setters null-safety consistent
This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
2017-07-19 09:07:56 +02:00
Juergen Hoeller c292a89b24 Http(Async)Client not actually nullable, plus MethodInterceptor nullability
Issue: SPR-15720
2017-07-19 00:15:37 +02:00
Rossen Stoyanchev 43f2de4671 Defensive checks in WebClient and Reactor connector
Since there is no reason for an exchange to ever complete without a
ClientResponse I've added a switchIfEmpty check at the WebClient level.

Also, temporarily a second check closer to the problem in the
ReactorClientHttpConnector suggesting a workaround and providing a
reference to the Reactor Netty issue #138.

Issue: SPR-15784
2017-07-18 18:13:47 +02:00
Rossen Stoyanchev 7a0e5a378a Update for reactor-core change 2017-07-18 04:09:25 +02:00
Juergen Hoeller 12114a9d4c Consistent use of NIO.2 for file read/write interactions
Issue: SPR-15748
2017-07-18 00:54:41 +02:00
Rossen Stoyanchev ee91e52c3a Polish 2017-07-17 11:39:32 +02:00
Rossen Stoyanchev e2ee23bfc5 WebSession supports changeSessionId
Issue: SPR-15571
2017-07-17 11:09:38 +02:00
Rossen Stoyanchev 47b63150d1 Refactor DefaultWebSession
Use copy constructor to refresh a session with lastAccessTime and a
save function referencing the current exchange. As a result both fields
are now final and ConfigurableWebSession is no longer needed.
2017-07-14 22:55:56 +02:00
Rossen Stoyanchev bf712957f6 Polish WebSession support code 2017-07-14 22:55:56 +02:00
Rossen Stoyanchev e37af83459 Improve docs on on use of urlDecode=false
Issue: SPR-15643
2017-07-14 16:52:02 +02:00
Juergen Hoeller 301e2ea493 Nullability fine-tuning and related polishing
Issue: SPR-15720
2017-07-13 21:20:42 +02:00
Sebastien Deleuze f46520e6e8 Add Jackson Smile support to WebFlux
This binary format more efficient than JSON should be useful for server
to server communication, for example in micro-services use cases.

Issue: SPR-15424
2017-07-13 17:57:07 +02:00
Rossen Stoyanchev d9eafce266 Polish 2017-07-13 06:10:29 +02:00
Juergen Hoeller 5f767a86f5 Always invoke Jackson serialization with AtomicReference cause
Issue: SPR-15760
2017-07-12 19:13:03 +02:00
Rossen Stoyanchev 8359201a0d Improve write completion handling in ChannelSendOperator
Avoid re-using the WriteBarrier as the Subscription to both the
completionSubscriber and the writeSubscriber.

Instead DownstreamBridge is now called WriteCompletionBarrier and is
both a Subscriber and Subscription, i.e. handles all signals to and
from the completion Subscriber.

This frees the request method implementation in WriteBarrier to assume
it can only be called by the writeSubscriber and hence it's safe to
pass on request signals to the write source outside the synchronized
block.
2017-07-12 18:49:28 +02:00
Arjen Poutsma 6329ccb327 Read-Only HttpHeaders only created when necessary
This commit introduces a boolean `readOnly` flag in `HttpHeaders`,
which is used to check if creating a new `HttpHeaders` instance is
necessary in `readOnlyHttpHeaders`.
2017-07-12 18:13:24 +02:00
Arjen Poutsma f4180eb359 Removed faulty test 2017-07-12 15:02:50 +02:00
Rossen Stoyanchev 9ac71afbda Fix one failing test and @Ignore another
The failures look like older failures possibly exposed by recent
changes in Reactor.

The one in ViewResolutionResultHandler is very old test error.
The one in Jackson2JsonDecoderTests is more recent but went unreported.
2017-07-12 13:16:51 +02:00
Rossen Stoyanchev 89a5c857ac Fix recently intorduced bug in ChannelSendOperator
WriteBarrier acts as Subscription to both completionSubscriber and
writeSubscriber so the request method needs to be careful not to
pass on the request outside of readyToWrite or writeSubscriber checks.
2017-07-12 12:40:51 +02:00
Rossen Stoyanchev fbcd554f42 Fix method order in ChannelSendOperator
1. Group by contract
2. Follow lifecycle -- Subscriber 1st, Subscription 2nd, Publisher last
3. Order of declaration in implemented contracts
2017-07-12 12:29:38 +02:00
Rossen Stoyanchev 42188020b4 Polish ChannelSendOperator 2017-07-12 12:21:04 +02:00
Stephane Maldini b3a05ebac9 Inline super SubscriberAdapter with ChannelSendOperator
Add support for CoreSubscriber context passing
2017-07-11 13:12:07 -07:00
Rossen Stoyanchev 134ceac58e Set all strategies in CNM factory bean
ContentNegotiationManagerFactoryBean now provides an option to
explicitly set the strategies to use vs customizing a fixed
list of default strategies.

Issue: SPR-11114
2017-07-11 21:00:57 +02:00
Rossen Stoyanchev befacf4a35 ParameterContentNegotiationStrategy uses MediaTypeFactory
Issue: SPR-15649
2017-07-11 17:54:16 +02:00
Arjen Poutsma 2f9bd6e075 Add local error handling in WebClient.retrieve
This commit introduces a way to customize the WebClientExceptions, as
thrown by WebClient.ResponseSpec.bodyTo[Mono|Flux]. The first
customization will override the defaults, additional customizations are
simply tried in order.

Issue: SPR-15724
2017-07-11 16:36:40 +02:00
Rossen Stoyanchev eb84547894 Fix MockMvc + HttpPutFormContentFilter issue
Issue: SPR-15753
2017-07-11 11:43:48 +02:00
Rossen Stoyanchev c93792b8c9 Allow custom separator in PathContainer 2017-07-11 10:56:19 +02:00
Rossen Stoyanchev 0e370e0703 Separate out URL path parsing in PathContainer
PathContainer now has separate parsePath and parseUrlPath methods each
creating PathSegment and UrlPathSegment respectively.
2017-07-11 10:56:19 +02:00
Rossen Stoyanchev 1d201a55db Refine PathContainer.Segment value representation
Segment.value() now returns the actual original path segment value
including path parameters while semicolonContent() is removed.

valueDecoded() is renamed to valueToMatch() to reflect it is the value
for pattern matching which is not only decoded but also has path
parameters removed.
2017-07-11 10:54:42 +02:00
Rossen Stoyanchev 2f17c5f3b6 From static to instance-based PathContainer#subPath 2017-07-11 06:05:36 +02:00
Rossen Stoyanchev 9f7d57f933 Encapsulate choice of URI encoding within RequestPath
Currently the URI path is always treated as UTF-8 so we can eliminate
the encoding parameter from RequestPath#parse.
2017-07-11 06:05:36 +02:00
Rossen Stoyanchev 9640cedeae Removing remaining use of PathPattern with String path 2017-07-07 19:20:36 +02:00
Juergen Hoeller 00f4c36d7a Nullability fine-tuning (RequestContext, LocaleResolver)
Includes page-level JSTL time zone support for JSP tags.

Issue: SPR-15720
Issue: SPR-15746
2017-07-07 18:46:19 +02:00
Arjen Poutsma e458862849 Reflect recent Reactor changes 2017-07-07 15:24:15 +02:00
Rossen Stoyanchev e0de7754cc Polish 2017-07-07 09:44:02 +02:00
Renato Soppelsa 3dd6069578 Add UTF8 problem+json media type constant
Issue: SPR-15742
2017-07-07 09:42:50 +02:00
Arjen Poutsma b0ab84657b Disable "failOnServerError" in ReactorClientHttpRequest
This commit disables the "failOnServerError" feature on the
`HttpClientRequest`, as wrapped by ReactorClientHttpRequest. 5xx errors
are supposed to be dealt with in the WebClient, not in the lower-level
components.

Issue: SPR-15739
2017-07-06 13:37:21 +02:00
Arjen Poutsma 625855c00f Add comment indicating path segment combining in UriComponents.normalize
Issue: SPR-15734
2017-07-06 11:45:13 +02:00
Juergen Hoeller 45d376b6af Polishing 2017-07-05 10:55:30 +02:00
Brian Clozel 9c93521512 Leverage PathPatternParser in CORS configuration source
Previously `UrlBasedCorsConfigurationSource` was relying on
`PathMatcher` implementations for matching incoming request lookup paths
with the configured path patterns for CORS configuration.

This commit replaces the use of `PathMatcher` with a `PathPatternParser`
that parses the string patterns into `PathPattenr` instances and allows
for faster matching against lookup paths.

Issue: SPR-15688
2017-07-04 16:01:18 +02:00
Violeta Georgieva fd1859c34c Adapt to the changes in Reactor Netty ClientOptions
ClientOptions/HttpClientOptions are now created via Builder
2017-07-04 15:26:29 +02:00
Brian Clozel baaa84e90f Include port info in HTTP headers for Netty client
This commit adds the port information in the "Host" HTTP request header
for the Netty-based HTTP client.

Issue: SPR-15706
2017-07-04 12:13:06 +02:00
Sebastien Deleuze 7a171c6ae9 Fix Kotlin return types to match @Nullable annotations 2017-07-04 11:27:54 +02:00
Arjen Poutsma de9196bbdc Change from flatMap to map
Changed main tokenbuffer decoding loop from using flatMap to using map.
2017-07-04 10:51:43 +02:00
Brian Clozel 839b6c18d4 Optimize Flux pipeline in ClientHttpRequest 2017-07-04 10:11:56 +02:00
Arjen Poutsma 2ccbc55ffd Use PathContainer in web.reactive.function.server
This commit uses the newly introduced `PathContainer` and `RequestPath`
support in the functional web framework. It exposes the path container
as property in `ServerRequest`, and uses that in the path-based
`RequestPredicates`.
2017-07-03 13:36:30 +02:00
Sebastien Deleuze 727ca4514a Stream custom types in Jackson2JsonEncoder
Issue: SPR-15727
2017-07-03 10:25:59 +02:00
Sebastien Deleuze 9901c38f9d Improve logging of DefaultCorsProcessor for rejected headers
Issue: SPR-15708
2017-07-03 09:47:43 +02:00
Sebastien Deleuze 1fa8410995 Leverage RFC_1123_DATE_TIME formatter in tests
Issue: SPR-15661
2017-07-02 22:33:43 +02:00
Rossen Stoyanchev 15cf9c1d78 Switch to ContainerPath variants in HandlerMapping's 2017-07-01 20:05:17 -04:00
Rossen Stoyanchev a5e54788cc Remove PathPatternComparator
Direct comparison of a pattern (as a String) to the path does not make
much sense now that we deal with URL encoding through PathContainer
which exposes (safely) decoded path segments.

Removing the PathPatternComparator also means we can keep patterns
pre-sorted instead of sorting them all the time. That probably offsets
any benefits from comparing to the lookup path for direct matches and
patterns are still sorted according to specificity.
2017-06-30 18:19:35 -04:00
Rossen Stoyanchev 850083ca6c Polish 2017-06-30 18:19:35 -04:00
Rossen Stoyanchev 8581afa621 WebFlux compiles after PathPattern/Container changes 2017-06-30 18:19:35 -04:00
Andy Clement 26448a0ebc Rework matching to use PathContainer 2017-06-30 18:19:35 -04:00
Rossen Stoyanchev fc3fcf05fd Refactor PathSegmentContainer -> PathContainer
The new PathContainer represent the path as a series of elements
including separators. This naturally represents leading/trailing
slashes and empty path segments which in turn makes it easier to match
in PathPattern as well as to reconstruct the path.
2017-06-30 18:19:35 -04:00
Violeta Georgieva 5f020d1ee7 Polish - the flag continueProcessing is not needed 2017-06-30 09:59:32 +03:00
Juergen Hoeller cc74a2891a @Nullable all the way: null-safety at field level
This commits extends nullability declarations to the field level, formalizing the interaction between methods and their underlying fields and therefore avoiding any nullability mismatch.

Issue: SPR-15720
2017-06-30 01:54:16 +02:00
Juergen Hoeller c4694c3f5c WebAsyncManager defensively ignores attribute type mismatch
Issue: SPR-15709
2017-06-30 01:53:30 +02:00
Rossen Stoyanchev 8f4eb23540 Remove use of Optional in SyncHandlerMethodArgumentResolver
... and a couple more protected methods in WebFlux

Issue: SPR-15718
2017-06-29 17:19:48 -04:00
Rossen Stoyanchev 7de6cfa1df Refactor WebSession#getAttribute options
Issue: SPR-15718
2017-06-29 15:23:36 -04:00
Rossen Stoyanchev 9253facf02 Refactor ServerWebExchange#getAttribute options
Issue: SPR-15718
2017-06-29 14:55:30 -04:00
Stephane Maldini cd643704ad Update to reactor core 3.1.0.B-S with context update for monoSendOperator
Explicit typing for older jvm compilation in BodyExtractor
2017-06-29 10:47:28 -07:00
Arjen Poutsma 58a5e7f17b Proper closing of resources
This commit introduces a `doFinally` block that properly signals the
end of input for the non-blocking XML and JSON parsers.
2017-06-29 16:48:53 +02:00
Arjen Poutsma 9d7b8503d0 Delay DataBuffer release until stream is closed
This commit changes the release of data buffers from a finally block
into a `doFinally()` lambda on the returned `Flux<XMLEvent>` stream.

Issue: SPR-15707
2017-06-29 16:19:03 +02:00
Stephane Nicoll b1f06fddd2 Polish
Issue: SPR-14528
2017-06-29 10:26:50 +02:00
Arjen Poutsma 31e0e53750 Leverage Jackson non-blocking parser
This commit introduces the Jackson2Tokenizer as a replacement for the
JsonObjectDecoder. The latter was dropped because of its complexity, and
hard dependency on Netty's ByteBuf.

The new Jackson2Tokenizer leverages the new non-blocking JSON parser,
using it to parse the incoming data buffers into TokenBuffers, each
token buffer representing one JSON object. As with JsonObjectDecoder,
it also supports streaming individual JSON array elements.

Issue: SPR-14528
2017-06-28 16:19:01 +02:00
Arjen Poutsma b778f94a07 Made ObjectMapper field private with protected accessor 2017-06-28 16:19:01 +02:00
Rossen Stoyanchev 667437e300 Polish 2017-06-27 18:48:45 -04:00
Sebastien Deleuze d728d597f2 Add missing license headers in Kotlin files 2017-06-27 14:39:26 +02:00
Juergen Hoeller 87430f3cd3 ListenableFuture provides CompletableFuture adaptation via completable()
Issue: SPR-15696
2017-06-27 00:43:37 +02:00
Rossen Stoyanchev 5b8f7f503f Deprecate adapter classes for async interceptors 2017-06-26 15:34:51 -04:00
Rossen Stoyanchev eb0479dee8 Polish 2017-06-26 14:50:11 -04:00
Violeta Georgieva e0678ba583 Add onError callback to DeferredResult
Issue: SPR-15614
2017-06-26 14:12:56 -04:00
Juergen Hoeller 098ff6f0f8 Compatibility with JDK 9 release candidate build (175)
Includes upgrade to Objenesis 2.6, Gradle 3.5.1, RxJava 2.1.1, JSON Binding API 1.0 final.

Issue: SPR-15686
Issue: SPR-15600
2017-06-26 18:58:59 +02:00
Sebastien Deleuze ba3a12e4cc Use fixed GMT time-zone for WebSession Clock
Issue: SPR-15675
2017-06-26 18:01:21 +02:00
Rossen Stoyanchev 97390fd939 Polish 2017-06-23 17:05:57 -04:00
Rossen Stoyanchev 8fc3b3bc37 Add WebTestClientConfigurer
Issue: SPR-15674
2017-06-23 14:45:46 -04:00
Rossen Stoyanchev c37c59f578 Consumer methods for WebHttpHandlerBuilder
Replace the more limited List-based methods to add filtes and exception
handlers with Consumer<List<?>> variants.
2017-06-23 07:12:10 -04:00
Sebastien Deleuze 5c1d8c7c59 Leverage ZonedDateTime in HttpHeaders
This commit introduces 2 new public methods in HttpHeaders in order
to leverage Java 8 ZonedDateTime in addition to the existing long
(with GMT time zone implied) variants:
 - ZonedDateTime getFirstZonedDateTime(String headerName)
 - void setZonedDateTime(String headerName, ZonedDateTime date)

This commit also leverages Java 8 thread-safe DateTimeFormatter for
HttpHeader implementation instead of SimpleDateFormat. As a consequence
of the usage of DateTimeFormatter.RFC_1123_DATE_TIME, HTTP date header
serialization could change slightly for single digit days from for
example "Thu, 01 Jan 1970 00:00:00 GMT" to
"Thu, 1 Jan 1970 00:00:00 GMT".

Issue: SPR-15661
2017-06-23 00:15:51 +02:00
Arjen Poutsma 0a4d3c14db Jackson2JsonDecoder should support empty JSON array
Before this commit, the Jackson2JsonDecoder was not able to decode an
empty JSON array (`[]`). After this commit, it is.

Issue: SPR-15685
2017-06-21 11:14:34 +02:00
Sebastien Deleuze 1e04cdfa7e Add CorsWebFilter
This new WebFilter implementation is designed to allow initial
CORS support when using WebFlux functional API. More high-level
API may be introduced later.

Issue: SPR-15567
2017-06-21 10:50:09 +02:00
Sebastien Deleuze 59e90943e4 Rename CorsProcessor#processRequest to process 2017-06-21 10:50:09 +02:00
Juergen Hoeller 03133630cb Missing @Nullable annotations in WebFlux, in particular around locale resolution
Issue: SPR-15036
Issue: SPR-15540
2017-06-20 18:08:42 +02:00
Juergen Hoeller 535103cd52 Fine-tune HTTP/RMI Invoker exception handling
Issue: SPR-15684
2017-06-20 16:50:35 +02:00
Juergen Hoeller c244f33f84 Polishing 2017-06-20 16:50:02 +02:00
Sebastien Deleuze 38db64e0d8 Warn when Jackson + Kotlin are used without jackson-module-kotlin
Issue: SPR-15658
2017-06-17 00:07:59 +02:00
Rossen Stoyanchev 4a21fb27fc Fix root path test and add more test cases 2017-06-15 16:14:12 -04:00
Rossen Stoyanchev 67e482aaf8 Fix ROOT_PATH constant to match recent changes
"/" should be 0 segments, isAbsolute=true, hasTrailingSlash=false
2017-06-15 15:40:32 -04:00
Rossen Stoyanchev 53e8ebe6a6 Fix failing test (after previous commit) 2017-06-15 11:07:39 -04:00
Rossen Stoyanchev 97917aa57d Add PathSegmentContainer subPath extracting method 2017-06-14 17:44:56 -04:00
Rossen Stoyanchev 1018bf771b Separate DefaultRequestPath/DefaultPathSegmentContainer 2017-06-14 17:44:56 -04:00
Rossen Stoyanchev 97a97f9bba RequestPath improvements
Static parse methods on PathSegmentContainer and PathSegment plus:

isEmpty() on PathSegmentContainer and PathSegment
isAbsolute() and hasTrailingSlash() on PathSegmentContainer
char[] alternative for valueDecoded() on PathSegment
2017-06-14 17:44:56 -04:00
Juergen Hoeller 7b5f96c804 HttpComponentsAsyncClientHttpRequestFactory supports plain HttpAsyncClient as well
Issue: SPR-15664
2017-06-14 17:10:44 +02:00
Juergen Hoeller 137fc48cc2 Polishing 2017-06-13 20:59:26 +02:00
Sebastien Deleuze 97909f2258 Support date properties in Content-Disposition HTTP header
Issue: SPR-15555
2017-06-13 15:17:48 +02:00
Sebastien Deleuze e0e6736bc5 Introduce LocaleContextResolver in WebFlux
This commit introduces LocaleContextResolver interface, which is used
at ServerWebExchange level to resolve Locale, TimeZone and other i18n
related informations.

It follows Spring MVC locale resolution patterns with a few differences:
 - Only LocaleContextResolver is supported since LocaleResolver is less
   flexible
 - Support is implemented in the org.springframework.web.server.i18n
   package of spring-web module rather than in spring-webflux in order
   to be able to leverage it at ServerWebExchange level

2 implementations are provided:
 - FixedLocaleContextResolver
 - AcceptHeaderLocaleContextResolver

It can be configured with both functional or annotation-based APIs.

Issue: SPR-15036
2017-06-13 15:10:18 +02:00
Juergen Hoeller a0cea9a86f Polishing 2017-06-13 14:20:33 +02:00
Juergen Hoeller 779deb0fa7 Cleanup of duplicate semicolons
Issue: SPR-15654
2017-06-13 11:38:05 +02:00
Stephane Nicoll 58242f2249 Polish 2017-06-13 10:13:14 +02:00
Stephane Nicoll fc64b8040f Polish "Replace relevant code with lambda"
Closes gh-1454
2017-06-13 09:42:20 +02:00
diguage 4b1478d830 Replace relevant code with lambda
See gh-1454
2017-06-13 08:55:38 +02:00
Brian Clozel 233c15b80e Add PathPatternRegistry for handler mapping matching
Previously `HandlerMapping` implementation were heavily relying on
`String` path patterns, `PathMatcher` implementations and dedicated maps
for matching incoming request URL to an actual request handler.

This commit adds the `PathPatternRegistry` that holds `PathPattern`
instances and the associated request handler — matching results are then
shared as `PathMatchResult` instances. `AbstractUrlHandlerMapping` will
use this registry directly, but other components dealing with request
matching (like `PatternsRequestCondition`) will directly use ordered
`PathPattern` collections since ordering is important there.

This opens the door for faster request matching and simplifies the
design of this part.

Issue: SPR-15608
2017-06-12 18:53:05 +02:00
Brian Clozel 1f0d107d37 Enable trailing slash matching by default
This commit enables trailing slash matching in `PathPatternParser` by
default - this mirrors the default configuration in `PathMatcher`
implementations in MVC.
2017-06-12 16:17:18 +02:00
Juergen Hoeller 3ae84d6dd8 Consistent support for Charset/StandardCharsets in UriUtils etc
Issue: SPR-15613
2017-06-12 15:51:45 +02:00
diguage 2efa06237a Use Map#forEach instead of Map#entrySet#forEach
See gh-1449
2017-06-12 14:37:33 +02:00
Arjen Poutsma 9bf82dc18f Add addAll(MultiValueMap)
This commit introduces a new method for MultiValueMap: addAll, which
adds all values of a given map (cf putAll, which replaces existing
values).
2017-06-12 14:12:12 +02:00
diguage c1d44d9a34 Use the diamond syntax
Closes gh-1450
2017-06-12 09:19:06 +02:00
Rossen Stoyanchev 38a12ed4ba Expose RequestPath in ServerHttpRequest
The new structured getPath() method replaces the existing
getContextPath() + getPathWithinApplication().

Issue: SPR-15648
2017-06-11 21:59:24 -04:00
Rossen Stoyanchev 2d17411ec4 Add RequestPath to http/server/reactive
Issue: SPR-15648
2017-06-11 21:59:24 -04:00
Juergen Hoeller e2e0410570 Method-level javadoc on XmlReaderContext etc 2017-06-11 12:03:05 +02:00
Rossen Stoyanchev b65bfdb979 Remove HttpRequestPathHelper
The use of the undecoded URL path by default and the removal of suffix
pattern matching effectively means HttpRequestPathHelper is no longer
needed.

Issue: SPR-15640, SPR-15639
2017-06-09 16:15:38 -04:00
Rossen Stoyanchev 95196e1aee Use undecoded pathWithinApplication in WebFlux
Introduce pathWithinApplication() in ServerHttpRequest and use it for
request mapping purposes instead of LookupPath.

In turn this means that for request mapping purposes:
1) the path is not decoded
2) suffix pattern matching is not supported

Issue: SPR-15640
2017-06-09 16:15:38 -04:00
Andy Clement ff2af660cf PathPatternParser encodes patterns as it parses them
Before this commit there was no special handling for URL encoding
of the path pattern string coming into the path pattern parser. No
assumptions were made about it being in an encoded form or not.

With this change it is assumed incoming path patterns are not
encoded and as part of parsing the parser builds PathPattern
objects that include encoded elements. For example parsing "/f o"
will create a path pattern of the form "/f%20o". In this form
it can then be used to match against encoded paths.

Handling encoded characters is not trivial and has resulted in
some loss in matching speed but care has been taken to
avoid unnecessary creation of additional heap objects.  When
matching variables the variable values are return in a
decoded form. It is hoped the speed can be recovered, at least
for the common case of non-encoded incoming paths.

Issue: SPR-15640
2017-06-09 13:08:07 -07:00
Sebastien Deleuze 86580b2358 Polishing 2017-06-09 01:49:56 +03:00
Sebastien Deleuze 8579ae66fc Add comprehensive tests of Kotlin extensions
This commit also removes extensions hidden by Java API (varargs).
2017-06-09 01:01:16 +03:00
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller 7eaedf2916 Debug-level log entry for any Jackson exception during canConvert
Issue: SPR-15582
2017-06-07 18:33:19 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Andy Clement 77576ed6fe Fix PathPattern comparator result for wildcard suffix usage
Without this change the comparator thinks "/{foo}"
is more specific than "/{foo}.*". The minimal fix here
to address it is to copy what the AntPathMatcher
comparator does which is to consider '.*' as *not*
a usage of a wildcard. See PatternInfo#initCounters()
for the AntPathMatcher handling of this.

This change ensures the PathPattern comparator now produces
the expected result but suffix usage in general needs more
thought at some point.

Issue: SPR-15597
2017-06-02 15:40:16 -07:00
Rossen Stoyanchev 4244df740b Consolidate matrix vars parsing in HttpRequestPathHelper
Restore matrix variable parsing code not resorting to the use of
WebUtils which brings Servlet API dependencies with it.

Instead the parsing logic is now exposed through HttpRequestPathHelper
which already contained the decoding logic and also the knowledge of
whether to decode the parsed variables or not.

Issue: SPR-15397
2017-06-02 15:52:44 -04:00
Rossen Stoyanchev d2685dfe67 Add static factory/accessor methods to LookupPath
Issue: SPR-15397
2017-06-02 15:15:42 -04:00
Rossen Stoyanchev a7020e419a Polish use of LookupPath 2017-06-02 14:46:34 -04:00
Brian Clozel 74fb2645fd Fix LookupPath parsing
Issue: SPR-15397
2017-06-02 09:26:35 +02:00
Rossen Stoyanchev 4d52590964 Improve docs on forwarded headers
Issue: SPR-15612
2017-06-01 22:36:12 -04:00
Rossen Stoyanchev 895fa2ea7b Add removeOnly mode to ForwardedHeaderFilter
Issue: SPR-15610
2017-06-01 15:39:19 -04:00
Brian Clozel cf1bc81199 Introduce LookupPath in WebFlux request routing
This commit adds the `LookupPath` class that contains the full
request path relative to the web context; the application can
get from it various information, including the file extension
and path parameters (if any).

Since that operation is done multiple times for each request, this
object is stored as an attribute at the `ServerWebExchange` level.

Issue: SPR-15397
2017-06-01 18:31:04 +02:00
Brian Clozel 0557404715 Throw exception for illegal PathMatch configurations
With the new `ParsingPathMatcher` implementation, new patterns are now
allowed, such as `"/foo/{*bar}". The `"{*bar}"` segment will capture
everything until the end of the given path. Adding other elements after
that segment is illegal and will throw exceptions.

One can configure on a `PathMatchConfigurer` various options like
`useTrailingSlashMatch` and `useSuffixPatternMatch`; those options, when
enabled, will try to append suffixes like `".*"` and `"/"` to existing
path patterns. In case of a "capture the rest" pattern segment, those
options won't be honored.

This is why this commit ensures that an exception is thrown at the start
of the application if an illegal configuration is applied to the
`PathMatchConfigurer`.

Issue: SPR-15303, SPR-15558
2017-06-01 18:30:18 +02:00
Rossen Stoyanchev b93579a43e Polish 2017-06-01 09:28:55 -04:00
Violeta Georgieva e8d2c6c74b AbstractListenerWriteProcessor/AbstractListenerWriteFlushProcessor error handling
When an exception happens while writing/flushing, the exception handling
for Servlet 3.1 based implementation will happen when
WriteListener#onError and AsyncListener#onError events are received
2017-06-01 09:19:45 -04:00
Violeta Georgieva 23a052c160 Clear the buffer provided by Undertow before reading the request
When reading more that once for a given request, the position/limit of
the buffer provided by Undertow should be reset in order to use the
full capacity of the buffer.
2017-06-01 15:14:25 +03:00
Arjen Poutsma 7894efdd1e Allow for null values in ExtractingResponseErrorHandler.hasError
This commit fixes the implementation of
ExtractingResponseErrorHandler.hasError to allow for null values,
indicating an override of the behavior inherited from
DefaultResponseErrorHandler.

Issue: SPR-15544
2017-06-01 11:44:08 +02:00
Rossen Stoyanchev e81651b657 Ignore empty Accept-Language header value
Issue: SPR-15603
2017-05-31 21:10:08 -04:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze c3e6afb879 Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
2017-05-31 17:14:49 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Rossen Stoyanchev 5dcfd84d3b MockServerHttpRequest and Response set cookie headers
Issue: SPR-15522
2017-05-30 11:00:15 -04:00
Rossen Stoyanchev 67bcef22e4 Polish MockServerHttpRequest|Response 2017-05-30 11:00:15 -04:00
Arjen Poutsma 4b0dedc45e Add ExtractingResponseErrorHandler
This commit introduces ExtractingResponseErrorHandler: an alternative
ResponseErrorHandler that uses `HttpMessageConverter`s to convert HTTP
error responses to `RestClientException`.

Issue: SPR-15544
2017-05-30 13:17:25 +02:00
Rossen Stoyanchev 1383ad5f91 Reasonable defaults for MultipartHttpMessageWriter
MultipartHttpMessageWriter is now configured to handle JSON and XML
out of the box.
2017-05-27 20:41:07 -04:00
Rossen Stoyanchev 03b344b579 Refactor DefaultCodecs implementation
Simplify the internals of the DefaultCodecs implementation favoring
explicit fields per override vs a generic list of readers and writers
for overrides.
2017-05-27 20:41:07 -04:00
Rossen Stoyanchev 1328c8f46e Simplify CodecConfigurer related type names
Essentially drop "Configurer" suffix from nested interfaces.
2017-05-27 20:41:07 -04:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Rossen Stoyanchev 2d37c966b2 Support for decoding @RequestPart content
Issue: SPR-15515
2017-05-26 18:03:01 -04:00
Rossen Stoyanchev be0b671191 Upgrade nio-multipart-parser to 1.1.0
Issue: SPR-15515
2017-05-26 09:19:10 -04:00
Juergen Hoeller e7b41bc30a Use Apache Johnzon 1.1 for JSON-B integration tests
Issue: SPR-15590
2017-05-25 23:37:14 +02:00
Rossen Stoyanchev 805fcc6a05 ResponseErrorHandler provides access to URI and method
Issue: SPR-15511
2017-05-24 15:34:40 -04:00
Arjen Poutsma 630fc194f0 Add HttpRequest.getMethodValue
This commit introduces a new method in HttpRequest:
`String getMethodValue`, which returns the HTTP method as a String.
Furthermore, HttpRequest.getMethod() has been given a default
implementation using this String value in combination with
`HttpMethod.resolve`.

Issue: SPR-15545
2017-05-24 16:36:58 +02:00
Juergen Hoeller 0183576215 Polishing 2017-05-23 22:05:22 +02:00
Juergen Hoeller db69a082d9 Avoid java.util.Optional signatures for simple field access
Issue: SPR-15576
2017-05-23 22:05:15 +02:00
Juergen Hoeller ce5e2b94c4 ProtobufJsonFormatHttpMessageConverter for configurable JSON processing
Issue: SPR-15550
2017-05-23 21:59:23 +02:00
Juergen Hoeller 113f0fb13f Javadoc suggests Jackson 2.9
Issue: SPR-14925
2017-05-23 21:59:16 +02:00
Andrey Kaipov 9c226aa742 Minor typo fix: form -> from
Closes gh-1411
2017-05-20 14:49:54 +02:00
Rossen Stoyanchev 11075f12bc Fix URI parsing in Reactor Netty request
Issue: SPR-15560
2017-05-19 21:47:27 -04:00
Juergen Hoeller 67881a5726 Polish PathPattern parser (including package change to web.util.pattern)
Issue: SPR-15531
2017-05-17 17:40:25 +02:00
Juergen Hoeller eaac348c05 Close InputStreams in writeResourceRegionCollection (analogous to writeResourceRegion)
Issue: SPR-15559
2017-05-17 14:34:50 +02:00
Rossen Stoyanchev 5ac7955de9 More qualified "request-id" header in WebTestClient
Issue: SPR-15501
2017-05-15 15:52:50 -04:00
Juergen Hoeller f985f71daf Polishing 2017-05-12 12:50:17 +02:00
Sebastien Deleuze 285fa1cc2c Fix typos in Kotlin extensions documentation 2017-05-10 17:22:27 +02:00
Arjen Poutsma b649041976 Add ServerHttpResponse.addCookie method
This commit adds a `addCookie(ResponseCookie)` method to the reactive
`ServerHttpResponse` interface.

Issue: SPR-15523
2017-05-09 10:18:39 +02:00
Rossen Stoyanchev add1305252 Re-add vararg options in WebHttpHandlerBuilder
WebHttpHandlerBuilder is low level not expected to appear frequently
but they might be repeated more in tests (e.g. of WebFilter's).

Issuse: SPR-15499
2017-05-08 15:50:27 -04:00
Rossen Stoyanchev 459457e1aa WebFilterChain delegation nested in Mono.defer()
Issue: SPR-15520
2017-05-08 15:36:31 -04:00
Rossen Stoyanchev 47d6e4a332 Immutable DefaultWebFilterChain
Issue: SPR-15517
2017-05-08 15:04:38 -04:00
Juergen Hoeller 5497416c2d Polishing 2017-05-08 09:10:36 +02:00
Juergen Hoeller f25c6ba9bc Polishing 2017-05-07 22:59:25 +02:00
Juergen Hoeller 25aef4d3cc ResponseStatusException reason is optional (with lazily constructed message)
Issue: SPR-15524
2017-05-06 12:53:03 +02:00
Juergen Hoeller 39f8bd663e Polishing 2017-05-05 23:19:08 +02:00
Juergen Hoeller 4fdd85324d Aligned exception handling in Jackson and JAXB codecs
Issue: SPR-15516
2017-05-05 23:19:01 +02:00
Rossen Stoyanchev 4d962a1793 Remove HttpStatus from HttpMessageConversionException
HttpMessageConverter's are client and server and arguably shouldn't
contain a server-side concept such a response status.

The status field is recent, it was added to differentiate 400 vs 500
errors with Jackson 2.9+ but there is no need for it since the same
distinction is reflected in raising an HttpMessageNotReadableException
vs a general HttpMessageConversionException.

Issue: SPR-15516
2017-05-05 14:44:08 -04:00
Rossen Stoyanchev 83e0e1604a Refine encoding/decoding exception handling
Starting with removing a package cycle on the use of
ResponseStatusException in the codec package, this commit generally
refines codec exception handling.

The new [Encoding|Decoding]Exception mirror the existing
HttpMessageNot[Readable|Writable]Exception and are used similarly
especially to differentiate betwen 400 and 500 errors when parsing
server request body content.

The commit also aligns some of the exception handling of JSON and XML
on the WebFlux side with that on the Spring MVC side.

Issue: SPR-15516
2017-05-05 14:29:43 -04:00
Rossen Stoyanchev d7e54cea84 Test commit 2017-05-05 09:41:54 -04:00
Rossen Stoyanchev 8231812a3c Jackson Encoder/Decoder accept custom MimeType's
Issue: SPR-15474
2017-05-04 18:05:55 -04:00
Rossen Stoyanchev afa1c93585 Fix error in mock server test code 2017-05-04 17:24:46 -04:00
Juergen Hoeller 652266bcc2 Polishing 2017-05-04 22:27:36 +02:00
Rossen Stoyanchev 75117f42b8 Use the configured charset for part headers
This comment extends the use of the charset property in
FormHttpMessageConverter to also include multipart headers with a
default of UTF-8.

We now also set the charset parameter of the "Content-Type" header to
indicate to the server side how to decode correctly.

Issue: SPR-15205
2017-05-04 15:59:54 -04:00
Rossen Stoyanchev bda2723933 Correct charset determination in Synchronoss reader 2017-05-04 13:30:56 -04:00
Rossen Stoyanchev bb744574e5 Remove optional javax.mail dependency from WebFlux
The MultipartHttpMessageWriter now directly encodes part header values
defaulting to UTF-8 and also specifies the charset in the
Content-Type header for the entire request.

This should work with something commonly used like Apache Commons
FileUpload which checks request.getCharacterEncoding() and uses it
for reading headers.
2017-05-04 13:12:44 -04:00
Rossen Stoyanchev a56f735edd Polish 2017-05-04 12:25:19 -04:00
Rossen Stoyanchev ac1db169a4 Drop "get" prefix from Part accessor methods 2017-05-04 10:13:16 -04:00
Rossen Stoyanchev 6f3051c677 Support for @RequestPart with reactive type wrapper
Issue: SPR-14546
2017-05-03 23:03:47 -04:00
Rossen Stoyanchev fc7bededd0 Support data binding for multipart requests in WebFlux
Issue: SPR-14546
2017-05-03 22:36:04 -04:00
Rossen Stoyanchev b5089ac092 Support @RequestBody Flux<Part> in WebFlux
This commit turns the Synchronoss NIO Multipart HttpMessageReader into
a reader of Flux<Part> and creates a separate reader that aggregates
the parts into a MultiValueMap<String, Part>.

Issue: SPR-14546
2017-05-03 18:46:41 -04:00