Commit Graph

1086 Commits

Author SHA1 Message Date
Rossen Stoyanchev
36510cf808 Server adapters release buffers on error/cancel
Review and update Servlet and Undertow adapters to release any data
buffers they be holding on to at the time of error or cancellation.

Also remove onDiscard hooks from Reactor and Undertow request body.
For Reactor we expect it to be handled. For Undertow there isn't
any Reactor Core upstream for the callback to be useful.

Issue: SPR-17410
2018-10-23 20:56:08 -04:00
Rossen Stoyanchev
c8e320019f HttpRange validates requested ranges
Issue: SPR-17318
2018-10-14 22:53:33 -04:00
Rossen Stoyanchev
d551710c32 Restore calls to setLocale in MockHttpServletResponse
Issue: SPR-17284
2018-10-05 13:53:19 -04:00
Juergen Hoeller
a21ce42558 MockHttpServletRequest allows for removing registered header entries
Issue: SPR-17295
2018-09-29 17:36:03 +02:00
Juergen Hoeller
5ca2c56cf0 Polishing 2018-09-17 14:39:54 +02:00
Juergen Hoeller
1d58fac54d UriComponentsBuilder copies query params through MultiValueMap.addAll
Issue: SPR-17256
2018-09-11 15:15:15 +02:00
Brian Clozel
6189e17d7c Fix empty body writing in EncoderHttpMessageWriter
Prior to this commit, an bug introduced in SPR-16949 prevented
`Mono.empty` bodies from being written to the response.

This commit ensures that empty bodies still trigger the writing to the
response and does not hang the processing of the exchange.

Issue: SPR-17220
Cherry-picked from: 280da61d5c
2018-08-27 21:19:12 +02:00
Rossen Stoyanchev
f23496ae32 Fix URI var encoding issue with '$'
When expanding and strictly encoding URI variables, there is no need to
quote `/` and `$` which will be encoded anyway.

Issue: SPR-17168
2018-08-13 11:57:44 +03:00
Kazuhiro Sera
a80f4caf37 Fix typos detected by github.com/client9/misspell
(cherry picked from commit be211ceead)
2018-08-09 00:49:27 +02:00
Rossen Stoyanchev
eaafcee077 Proper use of setComplete in ContextPathCompositeHandler
Issue: SPR-17144
2018-08-08 16:41:50 +03:00
Juergen Hoeller
93ef169c5c Polishing 2018-07-25 14:40:31 +02:00
Brian Clozel
f89511e7fe Switch order of multipart Content-Type directives
Since SPR-15205, the `FormHttpMessageConverter` is adding a `charset`
directive to the `Content-Type` request header in order to help servers
understand which charset is being used to encode headers of each part.

As reported in SPR-17030 and others, some servers are not parsing
properly such header values and assume that `boundary` is the last
directive in the `Content-Type` header.

This commit reorders the charset information right before the boundary
declaration to get around those issues.

Issue: SPR-17030
(Cherry-picked from 390bb871d8)
2018-07-20 18:16:53 +02:00
Rossen Stoyanchev
f1c55a3b4a UriComponentsBuilder method to configure URI variables
See Javadoc on UriComponentsBuilder#uriVariables for details.

This helps to prepare for SPR-17027 where the MvcUriComponentsBuilder
already does a partial expand but was forced to build UriComonents
and then create a new UriComponentsBuilder from it to continue. This
change makes it possible to stay with the same builder instance.

Issue: SPR-17027
2018-07-19 19:07:22 -04:00
Rossen Stoyanchev
34a0cdfc33 Minor fixes: UriComponentsBuilder, UriComponents, docs
After the latest changes, two small fixes in the clone method to copy
the encode flag, and in the encodeUriTemplate method to account for
possible null query params.

Improvements in the URI encoding section.

Issue: SPR-17039, SPR-17027
2018-07-19 19:07:22 -04:00
Juergen Hoeller
c0040a5508 Polishing 2018-07-18 14:03:54 +02:00
Rossen Stoyanchev
2bf7c18203 Add TEMPLATE_AND_VALUES mode to DefaultUriBuilderFactory
Issue: SPR-17039
2018-07-16 21:25:09 -04:00
Rossen Stoyanchev
9458186e83 Polish DefaultUriBuilderFactory 2018-07-16 21:24:52 -04:00
Rossen Stoyanchev
d81ec55a60 Support for encode() in UriComponentsBuilder
The ability to request to encode before `build()`, and more importantly
before expanding, allows stricter encoding to be applied to URI vars
and consequently to neutralize the effect of characters with reserved
meaning in a URI.

Issue: SPR-17039
2018-07-16 21:24:16 -04:00
Rossen Stoyanchev
6218db9831 Backport of InMemoryWebSession changes
- hooks to check expired sessions in both create and retrieve.
- maxSessions limit on the total number of sessions.
- getSessions method for management purposes
- removeExpiredSessions public API

Issue: SPR-17020, SPR-16713
2018-07-12 16:27:42 -04:00
Rossen Stoyanchev
7ea8ecb6ab Warn when SimpleAsyncTaskExecutor is used
Issue: SPR-16203
2018-07-11 11:21:49 -04:00
Juergen Hoeller
ac1e2879e5 Consistent throwing of HttpMessageNotReadableException (5.0.x revision)
Includes specific fine-tuning of ProtobufHttpMessageConverter and JAXB2 based message converters, as well as revised javadoc for abstract base classes.

Issue: SPR-16995
2018-07-03 16:23:36 +02:00
Juergen Hoeller
a631af80c1 Polishing
(cherry picked from commit 40efcc9)
2018-06-28 16:42:14 +02:00
Juergen Hoeller
e388ddfdde WebHttpHandlerBuilder retains ApplicationContext in copy constructor
Issue: SPR-16972

(cherry picked from commit 2a15962)
2018-06-28 16:41:13 +02:00
Rossen Stoyanchev
425c311d3c Correctly set maxAge and expires in ResponseCookie
Issue: SPR-16940
2018-06-14 13:16:55 -04:00
Brian Clozel
96eba8b997 Fix ResourceRegion HttpMessageConverter write checks
This commit fixes the write checks for
`ResourceRegionHttpMessageConverter`, which was previously not checking
properly the parameterized type (e.g. in case of a `List<Something>`).

Issue: SPR-16932
(Cherry-picked from 05ff8b722d)
2018-06-11 22:57:36 +02:00
Brian Clozel
dac97f1b7d Restrict HTTP methods on Reactive HiddenHttpMethodFilter
This commit restricts the allowed HTTP methods on HiddenHttpMethodFilter
(Reactive variant) to the following: PUT, DELETE, PATCH.

This filter is meant to be used to simulate those methods from HTML
forms sent by browsers, so no other methods are allowed.

Issue: SPR-16836
(Cherry-picked from a5cd01a4c8)
2018-06-11 19:17:00 +02:00
Brian Clozel
f2694a8ed9 Restrict HTTP methods on Servlet HiddenHttpMethodFilter
This commit restricts the allowed HTTP methods on HiddenHttpMethodFilter
(Servlet variant) to the following: PUT, DELETE, PATCH.

This filter is meant to be used to simulate those methods from HTML
forms sent by browsers, so no other methods are allowed.

Issue: SPR-16836
(Cherry-picked from f64fa3dea1)
2018-06-11 19:16:44 +02:00
Rossen Stoyanchev
72e7687b80 Polish CodecConfigurer related classes
Functionally equivalent updates to package private classes to improve
the code and make it easier to understand.
2018-05-21 21:15:05 -04:00
Rossen Stoyanchev
e3e975d7f9 Support for SslInfo in ServerHttpRequest#mutate
Issue: SPR-16830
2018-05-17 17:29:33 -04:00
Juergen Hoeller
d74a2730ec SimpleClientHttpResponse catches any Exception on close
Issue: SPR-16773

(cherry picked from commit 21fad8e)
2018-05-02 16:07:22 +02:00
Juergen Hoeller
a9548f93e4 Support for non-standard HTTP status in reactive ClientHttpResponse
Issue: SPR-16748

(cherry picked from commit a683472)
2018-05-02 16:04:01 +02:00
Sebastien Deleuze
b55f69deb1 Support decoding Mono in Jaxb2XmlDecoder
Issue: SPR-16759
2018-05-02 11:57:40 +02:00
Rossen Stoyanchev
f7376bdde3 Better assertion message in MockPart
Issue: SPR-16767
2018-04-25 10:00:18 -04:00
sdeleuze
eda2720471 Add default ctor to Reactive UrlBasedCorsConfigurationSource
Issue: SPR-16712
2018-04-11 14:41:06 +02:00
Rossen Stoyanchev
4454ffd2b1 Replace remaining use of block operator 2018-03-31 11:18:38 -04:00
Stephane Maldini
b8d32095a9 workaround multipart integration test using blocking receive inside netty thread 2018-03-30 15:43:11 -07:00
Juergen Hoeller
b165475eb6 Polishing 2018-03-29 16:05:52 +02:00
Rossen Stoyanchev
f9e6ea5482 MvcResult returns asyncResult after asyncDispatch
Issue: SPR-16648
2018-03-28 22:15:16 -04:00
Juergen Hoeller
d95bbb6b1b Test for hasError keeping body available in case of unknown status code
Issue: SPR-16604
2018-03-28 12:16:03 +02:00
Rossen Stoyanchev
5861e9685b Always specify charset for form data requests
Issue: SPR-16613
2018-03-27 19:56:09 -04:00
Rossen Stoyanchev
f3994467c4 Refine ContentNegotiationStrategy 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:19 -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
842c29103f MultipartBodyBuilder supports PublisherEntity as input
Issue: SPR-16601
2018-03-16 16:18:05 -04:00
Rossen Stoyanchev
313c6cef32 Polish 2018-03-16 16:18:05 -04:00
Juergen Hoeller
f8588e364a AcceptHeaderLocaleResolver keeps language match among supported locales
Issue: SPR-16599
2018-03-16 14:17:50 +01:00
Rossen Stoyanchev
7de2650a70 Drop @WebServlet annotation
Issue: SPR-16591
2018-03-16 00:14:54 -04:00
Rossen Stoyanchev
72bbb2619d Commit actions are (properly) deferred
Issue: SPR-16597
2018-03-15 23:17:57 -04:00
Juergen Hoeller
d4a8f76bf9 Consistent volatile access to running flag in Lifecycle implementations
Issue: SPR-16488
2018-03-15 15:17:55 +01:00
Rossen Stoyanchev
b8d94f8a20 Improve WebFlux support for response status exceptions
Support @ResponseStatus annotated exceptions.
Supported root cause exceptions with response status information.

Issue: SPR-16567
2018-03-14 20:07:00 -04:00
Juergen Hoeller
41730220f4 InterceptingClientHttpRequest adapts to StreamingHttpOutputMessage
Issue: SPR-16582
2018-03-12 22:31:48 +01:00