Commit Graph

3406 Commits

Author SHA1 Message Date
Rossen Stoyanchev
955f77bf5d Add error message to MockServerHttpRequest
Closes gh-25109
2020-05-27 18:57:02 +01:00
Yanming Zhou
94f1d77e22 Polish StringHttpMessageConverter.getContentTypeCharset()
Closes gh-25126
2020-05-26 18:26:21 +02:00
Sam Brannen
5392ac2e07 Add dependency on BouncyCastle for JDK 15+
With a recent upgrade to an early access build for JDK 15,
ServerHttpsRequestIntegrationTests began failing since Netty's
SelfSignedCertificate could not be properly initialized.

This commit adds a test fixture dependency on BouncyCastle which is now
needed by Netty's SelfSignedCertificate on JDK 15 or higher, since JDK 15
no longer supports the javax.security.cert.X509Certificate.

See: https://bugs.openjdk.java.net/browse/JDK-8241039
2020-05-25 17:30:27 +02:00
Rossen Stoyanchev
b5d9f27ca4 Merge branch '5.2.x' 2020-05-24 21:20:12 +01:00
Rossen Stoyanchev
4f65ba4e74 Simplify creation of HttpContext for Apache HttpClient
Closes gh-25066
2020-05-24 21:09:49 +01:00
Rossen Stoyanchev
23a66e016e UriBuilder javadoc update
Closes gh-25055
2020-05-24 21:09:13 +01:00
Rossen Stoyanchev
c3e55d537e DefaultResponseErrorHandler javadoc update
Closes gh-25067
2020-05-23 10:41:35 +01:00
Rossen Stoyanchev
d7a29bbcef DefaultClientResponseBuilder copies logPrefix
Closes gh-25069
2020-05-23 10:41:07 +01:00
Rossen Stoyanchev
8204055924 MockServerHttpRequest accepts custom HTTP method
Closes gh-25109
2020-05-23 10:40:25 +01:00
Sam Brannen
da071c1fce Remove unused code 2020-05-19 15:59:17 +02:00
Sam Brannen
59cab5e7d9 Polishing 2020-05-19 15:54:34 +02:00
Rossen Stoyanchev
5ca7928153 Use Servlet 4 mapping type if available
See gh-25100
2020-05-19 10:34:15 +01: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
16f1414e5c Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-05-18 20:18:31 +02:00
Juergen Hoeller
9631db71c4 Direct exposure of StringBuilder instead of intermediate String
Closes gh-25024
2020-05-18 20:09:24 +02:00
Juergen Hoeller
9999414b3b Merge branch '5.2.x' 2020-05-18 14:24:33 +02:00
Juergen Hoeller
c35b21b49f Consistent not-null assertions for configured interceptors
Closes gh-25088
2020-05-18 14:23:05 +02:00
Сергей Цыпанов
703d54677e Avoid unnecessary boxing/unboxing of primitives
Closes gh-25080
2020-05-15 18:01:59 +02:00
Brian Clozel
567265123b Avoid using regex matching for static patterns
Prior to this commit (and the previous one), the `AntPathStringMatcher`
(inner class of `AntPathmatcher`) would compile `Pattern` instances and
use regex matching even for static patterns such as `"/home"`.

This change introduces a shortcut in the string matcher algorithm to
skip the `Pattern` creation and uses `String` equality instead.
Static patterns are quite common in applications and this change can
bring performance improvements, depending on the mix of patterns
configured in the web application.

In benchmarks (added with this commit), we're seeing +20% throughput
and -40% allocation. This of course can vary depending on the number of
static patterns configured in the application.

Closes gh-24887
2020-05-15 17:07:58 +02:00
Sam Brannen
fe3b36af68 Polishing 2020-05-14 13:18:49 +02:00
Juergen Hoeller
3c1ee64b7f Explicit nullability declarations for all AOP Alliance methods
Includes consistent declarations in AOP Alliance related Spring AOP code.

Closes gh-24117
2020-05-13 23:33:47 +02:00
Brian Clozel
60fac67884 Polish 2020-05-13 21:59:16 +02:00
Brian Clozel
612a63c0f1 Optimize MediaType parsing
Prior to this commit, `MediaType.parseMediaType` would already rely on
the internal LRU cache in `MimeTypeUtils` for better performance. With
that optimization, the parsing of raw media types is skipped for cached
elements.
But still, `MediaType.parseMediaType` would first get a cached
`MimeType` instance from that cache and then instantiate a
`new MediaType(type, subtype, parameters)`. This constructor not only
replays the `MimeType` checks on type/subtyme tokens and parameters, but
it also performs `MediaType`-specific checks on parameters.
Such checks are not required, as we're using an existing `MimeType`
instance in the first place.

This commit adds a new protected copy constructor (skipping checks) in
`MimeType` and uses it in `MediaType.parseMediaType` as a result.

This yields interesting performance improvements, with +400% throughput
and -40% allocation/call in benchmarks. This commit also introduces a
new JMH benchmark for future optimization work.

Closes gh-24769
2020-05-13 21:36:06 +02: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
e881d4b144 Allow use of JsonInclude.Value
Closes gh-24824
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
Sam Brannen
3809d885b6 Fix Checkstyle violation 2020-05-12 18:49:41 +02:00
Сергей Цыпанов
6305a69cc1 Avoid StringBuilder.append(Object) in ContentDisposition
This commit avoids invoking StringBuilder.append(Object) in favor
of explicit method calls to append(String) and append(char) in
ContentDisposition.escapeQuotationsInFilename(String).

Closes gh-25056
2020-05-12 18:36:31 +02: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
c908ec1937 Wrappers for native headers on the client side
Native server request headers have been wrapped rather than copied
since 5.1. This commit applies the same change to the client side
where, to make matters worse, headers were copied repeatedly on every
access, see also previous commit ca897b95.

For Netty and Jetty the wrappers are the same as on the server side
but duplicated in order to remain package private.

See gh-24680
2020-05-11 08:49:28 +01:00
Rossen Stoyanchev
df99889aa6 Avoided repeated creation of ReadOnlyHttpHeaders wrapper
See gh-24680
2020-05-11 08:49:28 +01:00
Rossen Stoyanchev
3276f81851 Avoid one layer of HttpHeaders wrapping
See gh-24680
2020-05-11 08:49:28 +01:00
Rossen Stoyanchev
7f59381c7d Add support for RxJava 3
Closes gh-24170
2020-05-11 08:48:48 +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
d1708460e7 Log message for unused @ModelAttribute name
Closes gh-23877
2020-05-06 10:37:44 +01:00
Rossen Stoyanchev
66bb145247 Fix typo
See gh-23915, gh-25018
2020-05-06 06:35:43 +01:00
Rossen Stoyanchev
a7c736915a Polishing and completing contribution
See gh-24866
2020-05-05 18:20:45 +01:00
Rossen Stoyanchev
147b8fb755 Turn off use of path extensions by default
Closes gh-23915
2020-05-05 08:04:40 +01:00
Rossen Stoyanchev
153690e717 Merge branch '5.2.x' 2020-05-04 10:55:25 +01:00
Rossen Stoyanchev
aa97563853 Add UnknownContentTypeException
Closes gh-24964
2020-05-01 17:32:19 +01:00
Rossen Stoyanchev
c35b3e5c82 Fix race condition in WriteResultPublisher
Closes gh-24989
2020-05-01 17:06:18 +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
martin-tarjanyi
3bc1d42dcd Integrate Apache http client with WebClient
This commit introduces a ClientHttpConnector implementation backed by
Apache HttpComponents HttpClient 5.0.

Fixes gh-24700
2020-04-29 15:02:09 +02:00