Commit Graph

1514 Commits

Author SHA1 Message Date
Sam Brannen
eeb6c10fb7 Polishing 2020-06-22 14:03:06 +02:00
Sam Brannen
b733474c64 Polish contribution
See gh-25292
2020-06-22 13:23:40 +02:00
Undefined
53df8ca1f5 Introduce unit tests for IntegerToEnumConverterFactory
Closes gh-25292
2020-06-22 13:12:37 +02:00
Rossen Stoyanchev
d627f6049e Update "Forwarded: for" contribution
Closes gh-23582
2020-06-22 05:40:13 +01:00
Kirill Serebrennikov
883ad098f9 Add support for X-Forwarded-For and Forwarded for
See gh-23260, gh-23582
2020-06-22 05:40:13 +01:00
Sam Brannen
ab0e651547 Polish SerializationTestUtils, clean up warnings, etc. 2020-06-20 18:17:03 +02:00
Sam Brannen
9d5881e0ad Suppress warnings, remove unused code, etc. 2020-06-20 17:15:35 +02:00
Brian Clozel
6615e9c5ef Support multi-value X-Forwarded-Prefix headers
Prior to this commit, the Forwarded headers for Spring MVC and Spring
WebFlux did not support multiple prefix values for the
`"X-Forwarded-Prefix"` HTTP header.

This commit splits and processes multiple prefixes defined in the
dedicated header.

Closes gh-25254
2020-06-18 13:18:02 +02:00
Sam Brannen
8099fc8178 Use try-with-resources language construct where feasible
Closes gh-2063

Co-authored-by: igor-suhorukov <igor.suhorukov@gmail.com>
2020-06-16 22:57:45 +02:00
Arjen Poutsma
97aba77cc1 Merge branch '5.2.x' 2020-06-16 14:30:43 +02:00
Arjen Poutsma
9c3417f703 Convert non-unicode input when reading w/ Jackson
This commit makes sure that Jackson-based message converters and
decoders can deal with non-unicode input. It does so by reading
non-unicode input messages with a InputStreamReader.

This commit also adds additional tests forthe canRead/canWrite methods
on both codecs and message converters.

Closes: gh-25247
2020-06-16 11:45:53 +02:00
Rossen Stoyanchev
5225a57411 Support for parsed PathPatterns in Spring MVC
See gh-24945
2020-06-15 11:25:35 +01:00
Rossen Stoyanchev
a0f4d81db7 Remove http -> web package dependency
See gh-24406
2020-06-15 11:25:35 +01:00
Arjen Poutsma
202799e6fe Rethrow XMLStreamExceptions as DecodingExceptions
Prior to this commit, Jaxb2XmlDecoder and XmlEventDecoder threw
XMLStreamExceptions instead of DecodingExceptions (as the Decoder
contract defines).

This commit resolves this issue.

Closes: gh-24778
2020-06-10 15:56:45 +02:00
Arjen Poutsma
5f1326f233 Respect MimeType charset in Jackson codecs
Before this commit, Jackson2CodecSupport and subclasses
did not check media type encoding in the supportsMimeType
method (called from canEncode/canDecode).
As a result, the encoder reported that it can write
(for instance) "application/json;charset=ISO-8859-1", but in practice
wrote the default charset (UTF-8).

This commit fixes that bug.

Closes: gh-25076
2020-06-05 15:09:05 +02:00
Arjen Poutsma
6a829a322a Respect MediaType charset in Jackson converters
Before this commit, AbstractJackson2HttpMessageConverter and subclasses
did not check media type encoding in the canRead and canWrite
methods. As a result, the converter reported that it can write
(for instance) "application/json;charset=ISO-8859-1", but in practice
wrote the default charset (UTF-8).

This commit fixes that bug.

See: gh-25076
2020-06-05 15:09:05 +02:00
Arjen Poutsma
847629412f Respect MimeType charset in Jackson codecs
Before this commit, Jackson2CodecSupport and subclasses
did not check media type encoding in the supportsMimeType
method (called from canEncode/canDecode).
As a result, the encoder reported that it can write
(for instance) "application/json;charset=ISO-8859-1", but in practice
wrote the default charset (UTF-8).

This commit fixes that bug.

Closes: gh-25076
2020-06-05 10:53:28 +02:00
Arjen Poutsma
eb0aae066c Respect MediaType charset in Jackson converters
Before this commit, AbstractJackson2HttpMessageConverter and subclasses
did not check media type encoding in the canRead and canWrite
methods. As a result, the converter reported that it can write
(for instance) "application/json;charset=ISO-8859-1", but in practice
wrote the default charset (UTF-8).

This commit fixes that bug.

See: gh-25076
2020-06-05 10:52:42 +02:00
Sam Brannen
967478b3a7 Merge branch '5.2.x' 2020-05-28 14:45:44 +02:00
Sam Brannen
3201671ceb Polish contribution
See gh-25149
2020-05-28 14:37:18 +02:00
dlsrb6342
fce972eec8 Fix BaseCodecConfigurer clone bug
Prior to this commit, ExchangeStrategies custom codec's reader and
writer were not registered due to a bug in BaseCodecConfigurer.

This commit fixes this by correcting the implementation of the
DefaultCustomCodecs constructor used within BaseCodecConfigurer.

Closes gh-25149
2020-05-28 12:34:29 +02:00
Rossen Stoyanchev
23233c3041 Shared read-only instance of UrlPathHelper
In many places UrlPathHelper is created and used without any
customizations, in some cases repeatedly. This commit adds a
shared read-only UrlPathHelper instance with default settings.

See gh-25100
2020-05-19 10:34:15 +01:00
Juergen Hoeller
5de6ae6fca Ignore resolved bean from non-active scope in getIfAvailable/getIfUnique
Closes gh-24822
2020-05-13 19:25:20 +02:00
Rossen Stoyanchev
e88eb0ecf7 Option for advanced ObjectMapper customization
Closes gh-23017
2020-05-13 12:31:19 +01:00
Rossen Stoyanchev
b31f2bdad2 @ExceptionHandler resolves nested exceptions
See gh-23380
2020-05-13 12:31:19 +01:00
Brian Clozel
e4cb25f365 Reject "/path/**/other" patterns in PathPatternParser
Prior to this commit, patterns like `"/path/**/other"` would be treated
as `"/path/*/other"` (single wildcard, i.e. matching zero to many chars
within a path segment). This will not match multiple segments, as
expected by `AntPathMatcher` users or by `PathPatternParser` users when
in patterns like `"/resource/**"`.

This commit now rejects patterns like `"/path/**/other"` as invalid.
This behavior was previously warned against since gh-24958.

Closes gh-24952
2020-05-11 19:08:21 +02:00
Rossen Stoyanchev
94824e30a4 Avoid parse cookies when mutating request or response
When mutating a ServerHttpRequest or ClientResponse, the respective
builders no longer access cookies automatically which causes them to
be parsed and does so only if necessary. Likewise re-applying the
read-only HttpHeaders wrapper is avoided.

See gh-24680
2020-05-11 08:49:28 +01:00
Rossen Stoyanchev
8a59a63ade Merge branch '5.2.x' 2020-05-08 09:38:50 +01:00
Rossen Stoyanchev
19ba9087f5 HttpHeaders#equals handles wrapping correctly
Closes gh-25034
2020-05-08 09:37:37 +01:00
Rossen Stoyanchev
1da903dd59 Add PartHttpMessageWriter
Closes gh-24535
2020-05-08 07:54:50 +01:00
Sam Brannen
12e05280ad Upgrade to AssertJ 3.16 2020-05-06 15:22:23 +02:00
Rossen Stoyanchev
f28e08eceb Improving contribution
See gh-24406
2020-05-06 10:50:51 +01:00
Parviz ROzikov
816466e492 #24406 - Add String based URI template variants 2020-05-06 10:50:51 +01:00
Rossen Stoyanchev
a7c736915a Polishing and completing contribution
See gh-24866
2020-05-05 18:20:45 +01:00
Arjen Poutsma
7bd524e9d7 Add ClientHttpConnector test suite
This commit introduces a test suite for ClientHttpConnector
implementations, as well as fixes that resolve issues identified by
these tests.

Closes gh-24941
2020-04-29 15:21:22 +02:00
Brian Clozel
dc4cda1b13 WARN against invalid patterns with PathPatternParser
As of gh-24952, `PathPatternParser` will strictly reject patterns with
`"**"` in the middle of them. `"**"` is only allowed at the end of the
pattern for matching multiple path segments until the end of the path.

Currently, if `"**"` is used in the middle of a pattern it will be
considered as a single `"*"` instead. Rejecting such cases should
clarify the situation.

This commit prepares for that upcoming change and:

* logs a warning message if such a case is used by an application
* expands the MVC and WebFlux documentation about URI matching in
general

Closes gh-24958
2020-04-23 13:03:05 +02:00
Sébastien Deleuze
67955dfb35 Prevent duplicated Vary headers in CORS processing
Closes gh-24829
2020-04-15 11:23:59 +02:00
陈其苗
13970ae528 Use autoboxing instead of explicit wrapping in tests
Closes gh-24801
2020-04-01 14:34:20 +02:00
Sam Brannen
ddaf0029ae Polishing 2020-03-31 16:31:34 +02:00
Sam Brannen
329f08ad08 Suppress warnings in Gradle build 2020-03-31 12:17:58 +02:00
Qimiao Chen
7c831d2ef4 Replace anonymous inner classes with lambdas in tests
Closes gh-24808
2020-03-30 12:02:23 +02:00
Rossen Stoyanchev
3175f0771e Remove dumpString from DataBufferTestUtils
See gh-24786
2020-03-26 21:42:12 +00:00
Rossen Stoyanchev
dd3dd5d67d UriComponentsBuilder.cloneBuilder copies uriVariables
Closes gh-24772
2020-03-26 16:31:25 +00:00
Johnny Lim
0f50a9a60a Fix empty domain handling in ResponseCookie
This commit also updates its test to use its intended inputs.
2020-03-25 08:18:03 +00:00
Rossen Stoyanchev
e11373fe69 Unwrap XMLStreamException from cause
Closes: gh-24622
2020-03-23 12:22:43 +00:00
Sam Brannen
17140c8d4b Polish contribution
See gh-24595
2020-03-17 17:15:12 +01:00
Andrew Woodbury
2fb13d410d Include response body in UnknownHttpStatusCodeException
Spring Framework 5.2.2 introduced a regression in
DefaultResponseErrorHandler.handleError(ClientHttpResponse)
Specifically, for use cases where the InputStream had already been
consumed by the first invocation of getResponseBody(), the second
invocation of getResponseBody() resulted in the response body being
absent in the created UnknownHttpStatusCodeException.

This commit fixes this by invoking getResponseBody() only once in
DefaultResponseErrorHandler.handleError(ClientHttpReponse) in order to
reuse the retrieved response body for creating the exception message
and as a separate argument to the UnknownHttpStatusCodeException
constructor.

Closes gh-24595
2020-03-17 17:06:57 +01:00
Rossen Stoyanchev
a599859595 ServerCookie ignores empty domain with double quotes
Closes gh-24663
2020-03-12 12:21:19 +00:00
Rossen Stoyanchev
d3da7a50ec Polishing and minor refactoring
See gh-24635
2020-03-04 19:17:56 +00:00
Rossen Stoyanchev
2afae430eb Update list of support multipart media types
See gh-24582
2020-03-03 15:38:00 +00:00