Commit Graph

1540 Commits

Author SHA1 Message Date
Rossen Stoyanchev
354635ede0 Polishing 2020-07-28 17:53:37 +03:00
Sam Brannen
cdc234d7db Polish contribution
See gh-25446
2020-07-22 14:06:29 +02:00
XenoAmess
c547809e89 Use instanceof instead of Class#isInstance where feasible
Closes gh-25446
2020-07-22 14:06:29 +02:00
Juergen Hoeller
88394bff66 Merge branch '5.2.x' 2020-07-20 07:21:36 +02:00
Juergen Hoeller
65e601090f Copy queryParams MultiValueMap through addAll (for independent List entries)
Closes gh-25423
2020-07-20 07:07:17 +02:00
Rossen Stoyanchev
0e4e25d227 Updates to CORS patterns contribution
Closes gh-25016
2020-07-08 13:18:46 +03:00
Rossen Stoyanchev
1181bb1852 Rename originsPattern to originPatterns
See gh-25016
2020-07-08 13:18:46 +03:00
Ruslan Akhundov
8632118e8d CorsConfiguration now supports pattern based origins.
Closes gh-24763
2020-07-08 13:18:46 +03:00
Johnny Lim
72e92211ce Polish mutateContextPathWithoutUpdatingPathShouldFail()
Closes gh-25352
2020-07-02 16:58:32 +02:00
Arjen Poutsma
f13ab6d18c Merge branch '5.2.x' 2020-07-01 13:29:15 +02:00
Arjen Poutsma
5b94d9b00b Use UTF-8 for application/*+json
This commit makes sure that the StringHttpMessageConverter reads
input with "application/*+json" as Content-Type with the UTF-8
character set.

Closes gh-25328
2020-07-01 10:46:58 +02:00
Arjen Poutsma
e251075d6c Merge branch '5.2.x' 2020-06-30 15:49:19 +02:00
Arjen Poutsma
79c339b03e Support for ASCII in Jackson codec & converter
This commit introduces support for writing JSON with an US-ASCII
character encoding in the Jackson encoder and message converter,
treating it like UTF-8.

See gh-25322
2020-06-30 15:46:54 +02:00
Sam Brannen
a92441186c Check for valid IPv6 host in UriComponentsBuilder.fromUriString
PR gh-358 introduced a "scheme but no host" check in the fromHttpUrl()
method in UriComponentsBuilder, but a similar check was not added to
fromUriString() at that time.

This commit introduces a "scheme but no host" check in fromUriString()
to align with the functionality in fromHttpUrl().

Note, however that the regular expressions used to match against the
hostname or IP address are inexact and still permit invalid host names
or IP addresses. True validation of the host portion of the URI is out
of scope for this commit.

Closes gh-25334
2020-06-29 18:36:21 +02:00
Sam Brannen
ba5f4f5414 Merge branch '5.2.x' 2020-06-26 18:31:07 +02:00
Sam Brannen
9876ca003b Support fragments in UriComponentsBuilder.fromHttpUrl()
Prior to this commit, UriComponentsBuilder.fromHttpUrl() threw an
IllegalArgumentException if the provided URL contained a fragment.

This commit aligns the implementation of fromHttpUrl() with that of
fromUriString(), by parsing a fragment and storing it in the builder.

Closes gh-25300
2020-06-26 18:30:09 +02:00
Sam Brannen
dd11dbf3b1 Polish UriComponentsBuilderTests 2020-06-26 14:58:06 +02:00
Rossen Stoyanchev
115ea253f6 Fix typo 2020-06-24 16:29:47 +01:00
Rossen Stoyanchev
b16f6fa456 Shared static instance of DefaultDataBufferFactory 2020-06-24 16:12:56 +01:00
Philippe Marschall
a142d21700 Use @SafeVarargs in Jackson builder and factory
Using @SafeVarargs in Jackson mapper builder and factory bean classes
allows the varargs methods to be used without a compiler warning. The
implementations of these methods do not perform unsafe operations on
their varargs parameter. It is therefore safe to add this annotation.

The following two methods are changed:

- add @SafeVarargs to Jackson2ObjectMapperBuilder#modulesToInstall
  and make it final
- add @SafeVarargs to
  Jackson2ObjectMapperFactoryBean#setModulesToInstall and make it final

This is a backwards incompatible change as these methods now have to be
declared final. Existing subclasses that override one of these methods
will break.

Closes gh-25311
2020-06-24 15:38:21 +02:00
Sam Brannen
b33d2fe683 Clean up warnings in Gradle build, polishing, etc. 2020-06-24 15:02:24 +02:00
Arjen Poutsma
973ee9b852 (Re)introduce DefaultMultipartMessageReader
This commit introduces the DefaultMultipartMessageReader, a fully
reactive multipart parser without third party dependencies.

An earlier version of this code was introduced in fb642ce, but removed
again in 77c24aa because of buffering issues.

Closes gh-21659
2020-06-24 10:31:48 +02:00
Rossen Stoyanchev
57f868fcbd Direct matches by URL path work again
This commit fixes a recent regression as a result of 5225a57411
with the determination of non-pattern vs pattern URLs. That in turn affects the ability to perform
direct matches by URL path.

There is also a fix in PathPattern to recognize "catch-all" patterns as pattern syntax.

See gh-24945
2020-06-24 08:07:40 +01:00
Rossen Stoyanchev
22bf62def1 Replace remaining use of deprecated Processors in tests
See gh-25085
2020-06-23 20:29:35 +01:00
Brian Clozel
1f78cede72 Merge branch '5.2.x' 2020-06-22 19:21:32 +02:00
Brian Clozel
c4326cb0f5 Fix missing contextPath when mutating ServerHttpRequest
This commit ensures that when mutating `ServerHttpRequest` instances,
the original contextPath information is copied to the request being
built.

Note that mutation on the `contextPath(String)` or `path(String)` should
be reflected to the other. (See their Javadoc for more information).

Fixes gh-25279
2020-06-22 19:13:10 +02:00
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