Commit Graph

1798 Commits

Author SHA1 Message Date
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
Brian Clozel
f1680e5cee Configure quiet period for shutting down Reactor resources
This commit adds two new properties to the `ReactorResourceFactory`.
This allows to configure the quiet and timeout periods when shutting
down Reactor resources. While we'll retain Reactor Netty's default for
production use, this option is useful for tests and developement
environments when developers want to avoid long waiting times when
shutting down resources.

Fixes gh-24538
2020-02-24 18:15:59 +01:00
Arjen Poutsma
4882eb278d Convert non-UTF-8 JSON
Jackson's asynchronous parser does not support any encoding except UTF-8
(or ASCII). This commit converts non-UTF-8/ASCII encoded JSON to UTF-8.

Closes gh-24489
2020-02-20 11:14:53 +01:00
Hyunjin Choi
37ba57a921 Polish some test classes by using predefined constants
Closes gh-24532
2020-02-18 12:24:10 +01:00
Rossen Stoyanchev
28a95e89f3 Upgrade to Dysprosium SR5 snapshots
See gh-24355
2020-02-11 12:52:04 +00:00
Rossen Stoyanchev
df706f4c7c Restore use of Flux-based encode method in HTTP
Closes gh-24441
2020-02-07 21:44:44 +00:00
Arjen Poutsma
a03a116f6b Force TokenBuffer to use BigDecimal if elementtype
This commit makes the Jackson2Tokenizer enable
TokenBuffer.forceUseOfBigDecimal if the element type given to the
Decoder is BigDecimal. Previous to this commit, values would be
converted to floats.

Closes gh-24479
2020-02-07 14:16:21 +01:00
Arjen Poutsma
45555f77a6 Honour ObjectMapper feature in Jackson2Tokenizer
After this commit, Jackson2Tokenizer honours ObjectMapper's
DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS feature when creating
TokenBuffers.

Closes gh-24479
2020-02-07 10:45:00 +01:00
Rossen Stoyanchev
ba5fc21ab4 Option to pair AnnotationIntrospector instances
Closes gh-22830
2020-02-05 20:49:07 +00:00
Rossen Stoyanchev
cc4261c30b Only non-null input resets scheme specific part
Closes gh-24444
2020-01-30 06:16:43 +00:00
Rossen Stoyanchev
542e187831 Expose media type mappings in ContentNegotiationManager
ContentNegotiationManagerFactoryBean now ensures that
ContentNegotiationManager contains the MediaType mappings even if the
path extension and the parameter strategies are off.

There are also minor fixes to ensure the media type mappings in
ContentNegotiationManagerFactoryBean aren't polluted when mapping keys
are not lowercase, and likewise MappingMediaTypeFileExtensionResolver
filters out duplicates in the list of all file extensions.

See gh-24179
2020-01-22 13:35:09 +00:00
Arjen Poutsma
54669c51c9 Use Jackson SequenceWriter for streaming
Before this commit, the AbstractJackson2Encoder instantiated a
ObjectWriter per value. This is not an issue for single values or
non-streaming scenarios (which effectively are the same, because in the
latter values are collected into a list until offered to Jackson).
However, this does create a problem for SMILE, because it allows for
shared references that do not match up when writing each value with a
new ObjectWriter, resulting in errors parsing the result.

This commit uses Jackson's SequenceWriter for streaming scenarios,
allowing Jackson to reuse the same context for writing multiple values,
fixing the issue described above.

Closes gh-24198
2020-01-21 14:22:00 +01:00
Rossen Stoyanchev
5e9d29d813 Ability to customize default Smile codecs
Closes gh-24382
2020-01-20 17:29:59 +00:00
Rossen Stoyanchev
5d8c5b0d9b Avoid NPE on comment SSE event
Closes gh-24389
2020-01-20 11:26:58 +00:00
Sam Brannen
1c270d8d06 Fix Checkstyle violation 2020-01-13 18:21:36 +01:00
Rossen Stoyanchev
29fe65d23c Upgrade to Dysprosium snapshots
See gh-24349
2020-01-13 16:49:42 +00:00
Rossen Stoyanchev
cbc57460b7 Support for maxInMemorySize in SSE reader
Closes gh-24312
2020-01-13 14:57:14 +00:00