Commit Graph

2480 Commits

Author SHA1 Message Date
Juergen Hoeller
85ec9b9df2 Avoid Class.getPackage() in favor of plain Class.getName() checks
Fixes #22306
2019-01-25 15:35:49 +01:00
Juergen Hoeller
7cc700435b HandlerMethod skips interface parameter introspection for return value
Fixes #22303
2019-01-24 15:18:55 +01:00
Rossen Stoyanchev
e373b46660 Jackson2JsonDecoder tolerates null literal
Fixes #22042
2019-01-18 18:27:40 -05:00
Rossen Stoyanchev
5dcde9e7d7 Trim decoded SSE data
Fixes #22043
2019-01-18 18:13:58 -05:00
Rossen Stoyanchev
a77eee899a Document synchronous use of the WebClient
Fixes #22173
2019-01-18 17:46:16 -05:00
Juergen Hoeller
72dddfbc7b Polishing 2019-01-09 12:26:58 +01:00
Rossen Stoyanchev
dc3f953f4b Correction for commit #b219c6c
Issue: SPR-17630
2019-01-08 22:43:42 -05:00
Juergen Hoeller
a82f049083 FormHttpMessageConverter officially supports non-String form values
Issue: SPR-17645
2019-01-08 17:11:07 +01:00
Rossen Stoyanchev
b219c6ce15 Adjust UriComponentsBuilder#toUriString behavior
Commit #93b7a4 added support for pre-configuring URI variables at the
UriComponentsBuilder level, and also changed toUriString to encode
template and URI variables separately. However this went a bit too far
causing side effects for URLs with curly braces that don't represent
URI variables.

This commit restores the original toUriString behavior which is to
encode template and URI variables sepraately only if URI variables have
been pre-configured.

Issue: SPR-17630
2019-01-08 11:06:33 -05:00
王诗峣
b94e8c4bef Fix ClassCastException in FormHttpMessageConverter
We should not cast MultiValueMap<String, ?> to MultiValueMap<String, String>
2019-01-08 12:19:51 +01:00
Juergen Hoeller
6e3f974951 HttpHeaders.writableHttpHeaders properly handles HttpHeaders.EMPTY
Issue: SPR-17633
2019-01-08 00:32:27 +01:00
Juergen Hoeller
1faeeaea14 HandlerMethodParameter defensively handles interface annotation arrays
Issue: SPR-17629
2019-01-08 00:32:09 +01:00
Rossen Stoyanchev
673a20cb10 Defensive initialization of AsyncXMLInputFactory
Aalto's InputFactoryImpl already disables loading of external entities
by default (property "javax.xml.stream.isSupportingExternalEntities").
This commit goes further by applying the same defensive measures as we
do elsewhere for XMLInputFactory, which disables DTD completely.
Arguably there is no good reason to enable that by default in WebFlux.
2019-01-07 13:52:46 -05:00
Rossen Stoyanchev
63984800e4 Lenient URI template encoding
URI template encoding ignores mismatched curly braces, treating them as
literal parts instead.

Issue: SPR-17630
2019-01-02 16:36:08 -05:00
Rossen Stoyanchev
4b24bcb799 More accurate checks for presence of MediaType.ALL
Typically a straight up equals as well as Collections#contains
checks for MediaType.ALL is susceptible to the presence of
media type parameters.

This commits adds equalsTypeAndSubtype as well as an
isPresentIn(Collection<MimeType>) methods to MimeType to faciliate
with checks for MediaType.ALL.

Issue: SPR-17550
2019-01-02 14:32:50 -05:00
Brian Clozel
6361b0cb23 Write CharSequence instances to DataBuffers
Prior to this commit, one could write a `CharSequence` to an existing
`DataBuffer` instance by turning it into a byte array or `ByteBuffer`
first. This had the following disadvantages:

1. Memory allocation was not efficient (not leveraging pooled memory
when available)
2. Dealing with `CharsetEncoder` is not always easy
3. `DataBuffer` implementations, like `NettyDataBuffer` can use
optimized implementations in some cases

This commit adds a new `DataBuffer#write(CharSequence, Charset)` method
for those cases and also an `ensureCapacity` method useful for checking
that the current buffer has enough capacity to write to it..

Issue: SPR-17558
2018-12-20 21:33:33 +01:00
Arjen Poutsma
5e4a8966ee Make TomcatHttpHandlerAdapter aware of request/response wrappers
This commit makes TomcatServerHttpRequest aware of
HttpServletRequestWrappers, and TomcatServerHttpResponse aware of
HttpServletResponseWrappers.

Issue: SPR-17611
2018-12-19 12:16:14 +01:00
Violeta Georgieva
09da10cc6c Propagate the cancel signal to the downstream
Issue: SPR-17609
2018-12-18 15:04:08 -05:00
Juergen Hoeller
0e8ed5931d Revised backport version 5.0.11
Issue: SPR-17410
Issue: SPR-17433
2018-12-17 18:19:21 +01:00
Juergen Hoeller
a240cfcf2f Consistent support for if-(un)modified-since as ZonedDateTime/Instant
Includes DefaultRequestBodyUriSpec pre-resolving URI for HttpRequest.

Issue: SPR-17571
2018-12-17 16:21:39 +01:00
igor-suhorukov
93189a6733 String.indexOf() expressions can be replaced with a call to the String.contains() method available in Java 5 and newer. 2018-12-13 12:29:31 +01:00
Rossen Stoyanchev
38ae282c3b Update log category precision for all tests
Replace the full category capped at 36 chars with the class name only
and 1 char per package, e.g. org.apache.commons.Foo -> o.a.c.Foo
2018-12-12 11:40:33 -05:00
Rossen Stoyanchev
05d616240a StringHttpMessageConverter defaults to UTF-8 for JSON
Issue: SPR-17568
2018-12-12 11:40:33 -05:00
Rossen Stoyanchev
8eef97da33 HTTP header adapters print header values
Issue: SPR-17546
2018-12-12 11:40:33 -05:00
Juergen Hoeller
7b7a8196f5 Revised HttpHeaders javadoc 2018-12-12 13:20:58 +01:00
Juergen Hoeller
6eb0a60df9 Polishing 2018-12-12 11:16:53 +01:00
Juergen Hoeller
5bbbc82e19 Consistent handling of null header values in HttpHeaders
Issue: SPR-17588
2018-12-12 11:16:45 +01:00
wonwoo
9a13d93a6b Fix typo in javadoc
Closes gh-2049
2018-12-12 08:00:15 +01:00
Juergen Hoeller
6a012147c4 Consistent support for last-modified argument as Instant/ZonedDateTime
Issue: SPR-17571
2018-12-06 15:53:47 +01:00
Lars Grefer
9abd4ed33d Allow Instant and ZonedDateTime as Last-Modified header.
Issues: SPR-17571
2018-12-06 14:49:12 +01:00
Rossen Stoyanchev
7a5f8e03bc Refine check for multiple subscribers
Commit #c187cb2 introduced proactive rejection of multiple subscribers
in ReactorClientHttpResponse, instead of hanging indefinitely as per
https://github.com/reactor/reactor-netty/issues/503.

However FluxReceive also rejects subsequent subscribers if the response
is consumed fully, as opposed to being canceled, e.g. as with
bodyToMono(Void.class). In that case, a subsequent subscriber causes
two competing error signals to be sent, and one gets dropped and
logged by reactor-core.

This fix ensures that a rejection is raised in
ReactorClientHttpResponse only after a cancel() was detected.

Issue: SPR-17564
2018-12-04 21:27:37 -05:00
Juergen Hoeller
9efea7eb73 MockHttpServletRequest preserves original Accept-Language header value
Issue: SPR-17566
2018-12-04 22:07:43 +01:00
Juergen Hoeller
6d7827e36b Polishing 2018-12-03 23:53:00 +01:00
Francesco Komauli
66f822e600 Fix typo in Javadoc for UnsupportedMediaTypeStatusException
Response status 415 (unsupported media type) reported as of 416 (which is Range Not Satisfiable), mismatching with superclass constructor parameter HttpStatus.UNSUPPORTED_MEDIA_TYPE
2018-11-29 16:36:56 +01:00
Juergen Hoeller
97ac1c22c5 DefaultResponseErrorHandler makes use of HttpStatus.isError()
Issue: SPR-17439
2018-11-23 19:27:47 +01:00
Sebastien Deleuze
91de8d265e Fix ProtobufDecoder handling of split message size
This commit introduces a new readMessageSize(DataBuffer input) private
method, inspired from CodedInputStream#readRawVarint32(int, InputStream)
and adapted for DataBuffer using MessageDecoderFunction fields in
order to support use cases where the message size is split between
distinct chunks.

It also fixes handling of end of streams by using
DataBuffer#readableByteCount instead of -1 which is only relevant with
InputStream.

Issue: SPR-17429
2018-11-23 14:22:58 +01:00
Juergen Hoeller
77ab88b144 Polishing 2018-11-23 13:56:02 +01:00
Juergen Hoeller
738097def2 DefaultResponseErrorHandler detects non-standard error code as well
Issue: SPR-17439
2018-11-23 13:55:50 +01:00
Juergen Hoeller
ae8f680d2e Polishing 2018-11-22 18:21:56 +01:00
Rossen Stoyanchev
7e9857a663 ForwardedHeaderTransformer handles encoding correctly
Issue: SPR-17525
2018-11-21 10:54:39 -05:00
Arjen Poutsma
f3c29fe2e6 Add test for UriUtils.encode(String, Charset)
Issue: SPR-17451
2018-11-20 10:51:19 +01:00
Rossen Stoyanchev
abf9ce8a34 Improve handling of empty response with Mono<T>
Issue: SPR-17560
2018-11-19 16:48:38 -05:00
Brian Clozel
3203d39821 Remove Content-Length response header from errors
Prior to this commit, when errors happened before the response was
committed, the `Content-Length` response header would be left as is.
This can be problematic since the error can be handled later in the
chain and the response body changed accordingly. For example, Spring
Boot renders error pages in those cases. If the `Content-Length` is set,
HTTP clients can get confused and only consider part of the error
response body.

This commit ensures that any `Content-Length` response header is removed
in case of errors, if the response is not already committed.

This is done at the `AbstractServerHttpResponse` level, since errors can
be handled in multiple places and the response itself is the safest
place to handle this case.

As a consequence, this commit also removes `Content-Length` checks in
`EncoderHttpMessageWriter` since we now consider that we should rely on
the response body we're about to write rather than any previously set
value.

Issue: SPR-17502
2018-11-19 15:49:54 +01:00
Stephane Nicoll
7b6f2f8fb3 Polish contribution
Closes gh-2019
2018-11-19 08:45:33 +01:00
Hanope
bfb49c7249 Fix typos
See gh-2019
2018-11-19 08:41:21 +01:00
HeemangHan
729ce4108d Correct typos (#2018) 2018-11-17 16:31:01 +01:00
Rossen Stoyanchev
1a37345e84 Fix checkstyle violation and polish 2018-11-16 19:42:42 -05:00
Arjen Poutsma
539cfc24c6 Refactor AbstractEncoderTestCase
Refactor AbstractEncoderTestCase to resemble AbstractDecoderTestCase

Issue: SPR-17449
2018-11-16 14:33:26 +01:00
Arjen Poutsma
39ce989d1a Add and use AbstractDecoderTestCase
Introduce new base test case for decoder tests, and use it.

Issue: SPR-17449
2018-11-16 14:33:26 +01:00
Rossen Stoyanchev
ba3fef3e8a Refactor media types parsing improvements
Issue: SPR-17459
2018-11-13 23:02:09 -05:00