Commit Graph

2798 Commits

Author SHA1 Message Date
Sam Brannen
4000b244ff Forbid null converters in RestTemplate & HttpMessageConverterExtractor
Prior to this commit, RestTemplate and HttpMessageConverterExtractor did
not validate that the supplied HttpMessageConverter list contained no
null elements, which can lead to a NullPointerException when the
converters are accessed.

This commit improves the user experience by failing immediately if the
supplied HttpMessageConverter list contains a null element. This applies
to constructors for RestTemplate and HttpMessageConverterExtractor as
well as to RestTemplate#setMessageConverters().

Note, however, that RestTemplate#getMessageConverters() returns a mutable
list. Thus, if a user modifies that list so that it contains null values,
that will still lead to a NullPointerException when the converters are
accessed.

This commit also introduces noNullElements() variants for collections in
org.springframework.util.Assert.

Closes gh-23151
2019-06-18 16:13:20 +03:00
Sam Brannen
da903904c9 Fix Javadoc reference to MediaType#APPLICATION_CBOR_VALUE
{@value ...} cannot be used outside of the current type.
2019-06-18 13:00:00 +03:00
Sam Brannen
aa0a8d66a8 Polishing 2019-06-18 10:19:03 +03:00
Johnny Lim
7f67cecd10 Polish MappingMediaTypeFileExtensionResolver.addFileExtension()
Closes gh-23145
2019-06-18 10:10:30 +03:00
Arjen Poutsma
30af01fd4e Use DataBufferUtils.write in DefaultFilePart.transferTo
This commit makes sure that in DefaultMultipartMessageReader's
DefaultFilePart, the file is not closed before all bytes are written,
by using DataBufferUtils.write (see c1b6885191d6a50347aeaa14da994f0db88f26fe).

The commit also improves on the logging of the
DefaultMultipartMessageReader.

Closes gh-23130
2019-06-14 14:13:18 +02:00
Sam Brannen
99d10a671c Merge branch '5.1.x' 2019-06-14 14:51:08 +03:00
Sam Brannen
d18d4d865e Update Javadoc for HtmlUtils regarding Apache Commons Text
Closes gh-23122
2019-06-14 14:48:24 +03:00
Johnny Lim
293506013d Add since declarations for JettyClientHttpConnector constructor change
Closes gh-23128
2019-06-14 14:31:37 +03:00
Rossen Stoyanchev
14e2c6803e Support for RSocket composite metadata
Closes gh-22798
2019-06-12 17:11:30 -04:00
Juergen Hoeller
0a77477d32 Merge branch '5.1.x' 2019-06-12 18:16:30 +02:00
Juergen Hoeller
fc46abf0b7 Polishing 2019-06-12 18:04:06 +02:00
Juergen Hoeller
42c0d8ec7f Merge branch '5.1.x' 2019-06-12 14:14:40 +02:00
Juergen Hoeller
627d37f73b Thread-safe removal of destruction callbacks in web scopes
Closes gh-23117
2019-06-12 14:11:13 +02:00
Juergen Hoeller
bd76a160bb Merge branch '5.1.x' 2019-06-12 00:58:51 +02:00
Juergen Hoeller
4877736794 Polishing 2019-06-12 00:58:04 +02:00
Juergen Hoeller
7e02358166 Merge branch '5.1.x' 2019-06-12 00:05:01 +02:00
Juergen Hoeller
22aba8bf60 Upgrade to Apache HttpClient 4.5.9 2019-06-11 23:49:57 +02:00
Juergen Hoeller
a89bfffd8c Merge branch '5.1.x' 2019-06-11 23:16:03 +02:00
Juergen Hoeller
7dc92aa05d Polishing 2019-06-11 20:57:27 +02:00
Juergen Hoeller
1956cb1e57 Defensive concurrent access to shared file extension data structures
Closes gh-23064
2019-06-11 20:57:17 +02:00
Rossen Stoyanchev
1f05bd4ef3 Merge branch '5.1.x' 2019-06-07 16:08:29 -04:00
Rossen Stoyanchev
9f8148419f Separate "filtered" attribute for ERROR dispatch
Closes gh-22989
2019-06-07 16:07:56 -04:00
Sam Brannen
61bf45c86f Merge branch '5.1.x' 2019-06-06 17:40:51 +03:00
Ilya Lukyanovich
2ed81be831 Fix MockHttpServletRequest.setCookies to produce single cookie header
Prior to this commit, MockHttpServletRequest.setCookies() produced one
Cookie header per supplied cookie, resulting in multiple Cookie headers
which violates the specification.

This commit fixes this by ensuring that all cookie name-value pairs are
stored under a single Cookie header, separated by a semicolon.

Closes gh-23074
2019-06-06 17:13:21 +03:00
Sebastien Deleuze
098ac0bbb8 Annotate Object#equals parameter with @Nullable
Closes gh-23093
2019-06-06 14:18:30 +02:00
Brian Clozel
33becd8258 Allow separator configuration in PathPatternParser
This commit allows to configure a custom path separator when parsing and
matching path patterns with `PathPatternParser`, but also when parsing
incoming paths as `PathContainer` instances.

Closes gh-23092
2019-06-06 11:39:53 +02:00
Rossen Stoyanchev
ec91934730 Use correct file options for transferTo
Similar to fix applied to Synchronoss implementation in #cef98e.
2019-06-05 10:54:56 -04:00
Rossen Stoyanchev
1f35bb609b Fix checkstyle warning 2019-06-04 17:38:30 -04:00
Rossen Stoyanchev
69eba32284 Improved Part support in MultipartBodyBuilder
1. Add contentType and filename options to PartBuilder.

2. Revert recently committed #44659f since asyncPart can't properly
support Publisher of Part (only Mono, can't support filename), and
replace that with support for Part in the regular part method.

Closes gh-23083
2019-06-04 17:21:39 -04:00
Rossen Stoyanchev
8781c01edf Merge branch '5.1.x' 2019-06-04 16:42:13 -04:00
Rossen Stoyanchev
49e5c4dcf6 Polish MultipartBodyBuilder
Improve Javadoc
Consistently reject Publisher unless using asyncPart
Consistently set Content-Type when specified
2019-06-04 16:41:10 -04:00
Rossen Stoyanchev
e89fd5c3be Merge branch '5.1.x' 2019-06-03 16:34:58 -04:00
Rossen Stoyanchev
4f05da7fed Support escape character in ContentDisposition
Closes gh-23077
2019-06-03 16:03:35 -04:00
Sebastien Deleuze
5b04b04b69 Merge branch '5.1.x' 2019-05-29 11:54:40 +02:00
Sebastien Deleuze
4523d01a50 Fix Javadoc for HttpHeaders#setContentLanguage
Closes gh-23051
2019-05-29 11:53:38 +02:00
Johnny Lim
83078eb6fd Add constants for application/cbor to MediaType
Closes gh-23042
2019-05-28 18:51:25 +02:00
Brian Clozel
1cfedb20b8 Add new constructor to JettyClientHttpConnector
This commit adds a new constructor to `JettyClientHttpConnector` and
deprecates another one. Jetty is not creating `HttpClient` instances
using a builder API, but rather setting immutable configuration at
constructor time and using setters for the rest.

This commit addresses that by deprecating the constructor variant
accepting a `Consumer` and just delegating to Spring's implementation
for setting the client resources as needed.

Closes gh-22977
2019-05-28 16:59:51 +02:00
Sam Brannen
141ef9082f Clean up Mockito usage
This commit migrates to the MockitoJUnitRunner where sensible, which
will later allow for an easier migration to Mockito's extension for
JUnit Jupiter.

In addition, this commit deletes unnecessary stubbing for various mocks
and polishes test fixture setup in various test classes.
2019-05-28 13:59:43 +02:00
Sebastien Deleuze
bc205e0dbf Remove charset parameter from Spring MVC JSON content type
This change is a follow-up to the ones done as part of gh-22788.

Closes gh-22954
2019-05-27 18:14:19 +02:00
Phillip Webb
9d74da006c Migrate JUnit 4 assertions to AssertJ
Migrate all existing JUnit 4 `assert...` based assertions to AssertJ
and add a checkstyle rule to ensure they don't return.

See gh-23022
2019-05-23 15:52:49 -07:00
Phillip Webb
95a9d46a87 Migrate Hamcrest assertions to AssertJ
Migrate all existing `assertThat(..., Matcher)` assertions to AssertJ
and add checkstyle rules to ensure they don't return.

See gh-23022
2019-05-23 15:49:59 -07:00
Sam Brannen
f806594e60 Introduce getOrEmpty(String) convenience method in HttpHeaders
This commit introduces a getOrEmpty(String) method in HttpHeaders that
returns an immutable, empty list if no values are present for the
specified header name. This is provided as a convenience over the
existing get(String) method which returns null in such cases.

Closes gh-22949
2019-05-22 15:26:45 +02:00
Sam Brannen
9ca7354146 Polishing 2019-05-22 15:22:29 +02:00
Sam Brannen
819097a07a Clean up warning in Gradle build 2019-05-22 14:48:40 +02:00
Juergen Hoeller
8a33ef2d14 Merge branch '5.1.x' 2019-05-21 21:06:38 +02:00
Juergen Hoeller
5aa0de7ac8 Upgrade to OkHttp 3.14.2, Joda-Time 2.10.2, OpenPDF 1.2.17, JRuby 9.2.7 2019-05-21 20:47:06 +02:00
Juergen Hoeller
3645281c35 Polishing 2019-05-21 19:26:39 +02:00
Juergen Hoeller
c329bad42a Merge branch '5.1.x' 2019-05-21 00:16:35 +02:00
Juergen Hoeller
8cd3daad0d Polishing 2019-05-21 00:15:40 +02:00
Juergen Hoeller
171e8f56a3 Merge branch '5.1.x' 2019-05-20 22:27:37 +02:00