Commit Graph

4919 Commits

Author SHA1 Message Date
Juergen Hoeller 5faace0eb3 Predetermine validation groups on initialization
Closes gh-32068
2024-01-23 11:15:12 +01:00
Sam Brannen 3b2f6e74a6 Make assertions based on Annotation#toString() lenient
The behavior for the toString() implementation for annotations changed
in JDK 19, per my request to the JDK team (see link below).

Specifically, since JDK 19, the toString() implementation for annotation
proxies created by the JDK started using canonical names instead of
binary names for types.

See https://bugs.openjdk.org/browse/JDK-8281462
2024-01-23 10:41:40 +01:00
Brian Clozel 70d9f7c62c Record errors thrown by custom handler in RestTemplate observations
Prior to this commit, the `RestTemplate` observation instrumentation
would only record `RestClientException` and `IOException` as errors in
the observation. Other types of errors can be thrown by custom
components, such as `ResponseErrorHandler` and in this case they aren't
recorded with the observation.
Also, the current instrumentation does not create any observation scope
around the execution. While this would have a limited benefit as no
application code is executed there, developers could set up custom
components (such as, again, `ResponseErrorHandler`) that could use
contextual logging with trace ids.

This commit ensures that all `Throwable` are recorded as errors with the
observations and that an observation `Scope` is created around the
execution of the client exchange.

Fixes gh-32060
2024-01-22 11:03:57 +01:00
Juergen Hoeller 00bda65848 Polishing 2024-01-19 17:09:58 +01:00
Arjen Poutsma c820e44a99 Unwrap request factory when creating RestClient from RestTemplate
This commit makes sure that, when building a RestClient based on the
configuration of a RestTemplate, the request factory is unwrapped if it
is a InterceptingClientHttpRequestFactory.

Closes gh-32038
2024-01-19 15:41:31 +01:00
Sam Brannen 6691ff2072 Reject multiple @⁠HttpExchange declarations in HTTP interface clients
This commit updates HttpServiceMethod so that multiple @⁠HttpExchange
declarations on the same element (class or method) are rejected.

Closes gh-32049
2024-01-19 13:02:41 +01:00
rstoyanchev 1fba430dfc Update HttpExchange Javadoc to mention uses
See gh-32008
2024-01-18 18:35:28 +00:00
Sam Brannen efe85c0d70 Remove tautological ternary statement 2024-01-18 17:30:07 +01:00
Sam Brannen 2ec0c16889 Polishing 2024-01-18 17:30:07 +01:00
Arjen Poutsma 375e0e6827 Handle Content-Length in ShallowEtagHeaderFilter more robustly
This commit ensures that setting the Content-Length through
setHeader("Content-Length", x") has the same effect as calling
setContentLength in the ShallowEtagHeaderFilter. It also filters out
Content-Type headers similarly to Content-Length.

Closes gh-32039
2024-01-18 15:42:16 +01:00
Stéphane Nicoll f5b0d9509d Polish 2024-01-17 18:41:15 +01:00
Sam Brannen 699da7c383 Log warning if multiple @⁠RequestMapping annotations are declared
If multiple request mapping annotations are discovered, Spring MVC and
Spring WebFlux now log a warning similar to the following (without
newlines).

Multiple @⁠RequestMapping annotations found on
void org.example.MyController.put(), but only the first will be used:
[
@⁠org.springframework.web.bind.annotation.PutMapping(consumes={}, headers={}, name="", params={}, path={"/put"}, produces={}, value={"/put"}),
@⁠org.springframework.web.bind.annotation.PostMapping(consumes={}, headers={}, name="", params={}, path={"/put"}, produces={}, value={"/put"})
]

Closes gh-31962
2024-01-17 17:46:31 +01:00
Sam Brannen 5bf74cae11 Polish documentation for @⁠RequestMapping 2024-01-17 17:46:26 +01:00
Arjen Poutsma 0ada78ad84 Enable RestClient.defaultRequest
This commit enables the defaultRequest setting in the RestClient
builder.

Closes gh-32028
2024-01-17 11:23:50 +01:00
rstoyanchev 682f4715cf Polishing
See gh-30393
2024-01-17 10:15:09 +00:00
rstoyanchev c4a34fa26c Improve cancel handling in AbstractListenerReadPublisher
Closes gh-30393
2024-01-17 10:15:09 +00:00
Stéphane Nicoll 0c42965fc3 Polish 2024-01-15 11:17:19 +01:00
rstoyanchev 47779d6a53 Double-checked lock in ChannelSendOperator#request
Closes gh-31865
2024-01-12 17:15:47 +00:00
Arjen Poutsma b16f379788 Improve RestTemplate Javadoc
See gh-32016
2024-01-12 12:52:19 +01:00
rstoyanchev 50fad9ed05 Lenient port handling in HierarchicalUriComponents#toUriString
Closes gh-32003
2024-01-10 20:59:59 +00:00
rstoyanchev e7eaaaded1 Explicit initialization of shouldValidate flags
Closes gh-32007
2024-01-10 18:13:25 +00:00
Arjen Poutsma 49d3ec58fc Use timeout for JdkClientHttpRequest response retrieval
This commit ensures that, in JdkClientHttpRequest, the response is
obtained  using a timeout, instead of blocking indefinitely.

Closes gh-31911
2024-01-10 09:53:16 +01:00
Stéphane Nicoll c4405104a8 Polish 2024-01-09 17:31:34 +01:00
Arjen Poutsma e6f638132c Create case-insensitive copy in RestClientResponseException
Closes gh-31978
2024-01-09 12:11:02 +01:00
Stéphane Nicoll 1f2d29ee08 Polish 2024-01-08 17:12:33 +01:00
Sébastien Deleuze cffc8835c6 Mention parameter-names in Jackson2ObjectMapperBuilder documentation
Closes gh-31959
2024-01-08 14:59:02 +01:00
Sébastien Deleuze bd66763f26 Polishing
See gh-28546
2024-01-08 12:27:37 +01:00
rstoyanchev 8552e149b5 Improve method validation for container elements
This change moves container element properties from ParameterErrors
to base class ParameterValidationResult, and makes that support
independent of whether violations are nested within a container
element bean or through constraints on container elements, e.g.
`List<@NotBlank String>`.

Closes gh-31887
2024-01-05 16:32:14 +00:00
rstoyanchev e0d6b69195 Update contribution
Closes gh-30300
2024-01-04 14:53:13 +00:00
Yanming Zhou a3532bfccc ResponseStatusException reason as message code for ProblemDetail
See gh-30300
2023-04-06 17:18:27 +08:00
Sébastien Deleuze 318d460256 Add CORS support for Private Network Access
This commit adds CORS support for Private Network Access
by adding an Access-Control-Allow-Private-Network response
header when the preflight request is sent with an
Access-Control-Request-Private-Network header and that
Private Network Access has been enabled in the CORS
configuration.

See https://developer.chrome.com/blog/private-network-access-preflight/
for more details.

Closes gh-28546
2024-01-05 20:07:51 +01:00
Fabrice Bibonne a108e701bc Add Javadoc for use of regexp PathPattern
Closes gh-31886
2024-01-05 14:47:45 +01:00
Brian Clozel 1372265bd9 Undo workaround for SameSite support in WebFlux
This commit implements Cookie support in WebFlux without any workaround
as now all supported servers have the SameSite feature enabled.

Closes gh-31954
2024-01-05 14:44:32 +01:00
Stéphane Nicoll 549f6c1e80 Polish "Fix references to "application/*+xml" in Javadoc"
See gh-31951
2024-01-05 06:44:14 +01:00
pri88yank 16b4c25f7d Fix references to "application/*+xml" in Javadoc
See gh-31951
2024-01-05 06:44:02 +01:00
Stéphane Nicoll 2784f6008e Only log status in ServletRequestHandledEvent
This commit updates the description of RequestHandledEvent to avoid
providing a misleading status as the absence of a failure logs OK which
can be inaccurate.

Closes gh-27595
2024-01-04 11:47:59 +01:00
Sébastien Deleuze 207b9a14f4 Improve the documentation and discoverability of CoWebFilter
Closes gh-31877
2024-01-03 17:50:22 +01:00
Brian Clozel f846d9484c Add Javadoc to MockHttpServletResponse
This commit adds Javadoc to the `getContentLength` method of
`MockHttpServletResponse` to reflect that it gets its value from the
HTTP response header.

Closes gh-31833
2024-01-03 15:19:53 +01:00
Sam Brannen a3c11fc033 Clean up warnings in tests in Gradle build 2024-01-02 16:44:52 +01:00
Stéphane Nicoll e22d1efdc0 Update copyright year of changed files
See gh-31930
2024-01-01 11:00:56 +01:00
Johnny Lim ff8097d37c Polish
See gh-31930
2024-01-01 10:59:35 +01:00
Stéphane Nicoll 3c5d46166e Polish "Replace if with switch where feasible"
See gh-31916
2023-12-28 13:33:32 +01:00
Yanming Zhou cfa3aa001f Replace if with switch where feasible
See gh-31916
2023-12-28 13:29:50 +01:00
Stéphane Nicoll a6e87b40c7 Polish "Use diamond operator where feasible"
See gh-31916
2023-12-28 13:14:26 +01:00
Yanming Zhou 094479b55f Use diamond operator where feasible
See gh-31916
2023-12-28 13:08:08 +01:00
Stéphane Nicoll ed1bfb8177 Polish "Use text block where feasible"
See gh-31916
2023-12-28 13:01:44 +01:00
Yanming Zhou a35384fd57 Use text block where feasible
See gh-31916
2023-12-28 13:01:44 +01:00
Stéphane Nicoll 9d31537ae5 Polish "Use String.repeat() where feasible"
See gh-31916
2023-12-28 13:01:44 +01:00
Yanming Zhou dee1b726f9 Use String.repeat() where feasible
See gh-31916
2023-12-28 13:01:44 +01:00
Yanming Zhou 45080e3724 Remove unnecessary final modifier
final is useless for private and static methods

See gh-31916
2023-12-28 13:01:43 +01:00
Juergen Hoeller a338a16b29 Polishing 2023-12-27 23:23:38 +01:00
Brian Clozel 4afac17e58 Reject invalid forwarded requests in ForwardedHeaderFilter
Prior to this commit, the `ForwardedHeaderFilter` and the forwarded
header utils would throw `IllegalArgumentException` and
`IllegalStateException` when request headers are invalid and cannot be
parsed for Forwarded handling.

This commit aligns the behavior with the WebFlux counterpart by
rejecting such requests with HTTP 400 responses directly.

Fixes gh-31842
2023-12-22 17:27:06 +01:00
Juergen Hoeller 232225b2aa Polishing 2023-12-22 13:06:29 +01:00
Stéphane Nicoll cd8bc2f82a Remove useless empty inheritDoc Javadoc tag 2023-12-22 11:23:11 +01:00
rstoyanchev f0add920f5 Adjust container types to which methodValidation
After the updates to MethodValidationAdapter in commit d7ce13 related
to method validation on element containers, we also need to adjust
the checks in HandlerMethod when method validation applies.

See gh-31746
2023-12-21 17:50:40 +00:00
rstoyanchev 33c149077a Check constraints on container elements
We now check for constraint annotations on elements of a
container to decide whether to apply method validation.

Closes gh-31870
2023-12-21 17:35:19 +00:00
Sam Brannen 3476402a75 Polish switch statements 2023-12-21 17:30:56 +01:00
Juergen Hoeller b04803de99 Polishing 2023-12-21 17:20:29 +01:00
Sébastien Deleuze 85cb6cc5fb Support Kotlin extensions in web handlers
This commit restores support for Kotlin extensions in
web handlers, and adds support for invoking reflectively
suspending extension functions, as well as the other
features supported as of Spring Framework 6.1 like
value classes and default value for parameters.

Closes gh-31876
2023-12-21 12:16:33 +01:00
Brian Clozel 53b937976d Reject setups with multiple observation conventions
Prior to this commit, the `WebHttpHandlerBuilder` would only configure
a custom observation convention if there is a single convention in the
application context. It would other wise use the default.

This commit aligns with the previous Spring Boot behavior where multiple
conventions setups are rejected as invalid with
`NoUniqueBeanDefinitionException`.

Fixes gh-31864
2023-12-19 17:35:02 +01:00
Sébastien Deleuze 12f01f9b5f Add support for @RequestMapping on Kotlin property accessors
This commit refines InvocableHandlerMethod (both Servlet and
Reactive variants) in order to support annotated property
accessors as they translate into regular Java methods, instead
of throwing a NullPointerException.

Closes gh-31856
2023-12-19 12:29:55 +01:00
Sébastien Deleuze 917978cbc2 Refactor InvocableHandlerMethodKotlinTests
The variant in org.springframework.web.method.support in
order to allow testing with a various classes.

See gh-31856
2023-12-19 12:10:13 +01:00
rstoyanchev 3f5c3b1747 Fix checkstyle violation
See gh-31711
2023-12-18 15:32:18 +00:00
rstoyanchev bec7210b4b Improve check to skip bean validation in DataBinder
DataBinder should skip any jakarta.validation.Validator yielding
to method validation when that is expected. This change improves
the check to skip by unwrapping the validator from in a
SmartValidator before checking if it is for bean validation.

Closes gh-31711
2023-12-18 15:25:18 +00:00
rstoyanchev 0a94dce41d Improve HandlerMethod check when method validation applies
Method validation needs to be used for a container such as a List or
Map, but until now we were only checking for a List container.
Moreover, in gh-31530 we improved method validation to also cover
any Collection.

This change aligns with HandlerMethod check for when method validation
applies with the underlying ability of method validation.
2023-12-18 15:25:18 +00:00
Juergen Hoeller 045c5dc1b4 Detect Jetty 12 "max length exceeded" message in handleParseFailure
Closes gh-31850
2023-12-18 16:18:27 +01:00
Stéphane Nicoll d0574197ea Polish "Use String.repeat instead of explicit cycle"
See gh-31802
2023-12-18 14:10:16 +01:00
Adam Ostrožlík 63b2787da6 Use String.repeat instead of explicit cycle
See gh-31802
2023-12-18 13:54:03 +01:00
rstoyanchev ec0ec7a0d6 Avoid nested constructor binding if there are no request parameters
Closes gh-31821
2023-12-13 18:06:16 +00:00
Brian Clozel 0970b1dc7a Optimize ContentCachingRequestWrapper allocation
This commit builds on top of changes made in gh-29775 and gh-31737.
Before this change, we would allocate several byte arrays even in cases
of known request size. This could decrease performance when getting the
cached content as it requires merging several arrays and data is not
colocated in memory.

This change ensures that we create a `FastByteArrayOutputStream`
instance with the known request size so that the first allocated segment
can contain the entire content.
If the request size is not know, we will default back on the default
allocation size for the `FastByteArrayOutputStream`.

Closes gh-31834
2023-12-13 18:47:32 +01:00
rstoyanchev 125e2902be Polishing contribution
Closes gh-31778
2023-12-12 16:01:23 +00:00
HeartPattern 4d838c1092 Exclude Part from nested constructor binding in WebFlux
See gh-31778
2023-12-12 16:01:23 +00:00
Sam Brannen c0683cd30b Update copyright headers 2023-12-12 14:51:03 +01:00
Juergen Hoeller 7adc2f0779 Upgrade to Tomcat 10.1.16 and Jetty 12.0.4 2023-12-12 14:26:56 +01:00
Arjen Poutsma 134bb6e31f Document exception wrapping in RestClient status handlers
This commit documents the fact that any (Unchecked)IOExceptions or
HttpMessageNotReadableExceptions thrown from the error handler will be
wrapped in a RestClientException.

Closes gh-31783
2023-12-12 13:34:16 +01:00
Arjen Poutsma 57b8100a06 Copy headers map in RestClientResponseException to ensure serializability
This commit ensures that the HttpHeaders used are serializable by making
 a copy.

Closes gh-31787
2023-12-11 14:02:31 +01:00
Sébastien Deleuze d75a7c3818 Support multiple CoWebFilter changing the context
This commit ensures CoWebFilter merges the exchange
CoroutineContext with the filter one if needed.

Closes gh-31792
2023-12-11 11:35:19 +01:00
Sébastien Deleuze 91b9a75371 Box Kotlin value class parameters in web endpoint
In order to avoid "java.lang.IllegalArgumentException:
object is not an instance of declaring class" errors.

Closes gh-31698
2023-12-08 15:27:08 +01:00
Rossen Stoyanchev 2e07f9ab33 DefaultWebClient exposes full URI template as request attribute
Closes gh-30027
2023-12-07 12:16:22 +00:00
Sam Brannen 438c3818cc Replace System.getProperties().remove(x) with System.clearProperty(x)
This commit migrates to the not-so-new System.clearProperty() method
introduced in Java 1.5.
2023-12-06 17:11:46 +01:00
Sébastien Deleuze d410872e4f Polish CookieIntegrationTests 2023-12-06 15:01:09 +01:00
Sébastien Deleuze 8fe2c780df Support cookies with the same name with Reactor Netty
Ignore the related test with Undertow due to a bug in
their cookies handling.

Closes gh-28490
2023-12-06 15:01:09 +01:00
Arjen Poutsma 0e6c17f518 Process tokens after each feed in Jackson2Tokenizer
This commit ensures that we process after each fed buffer in
Jackson2Tokenizer, instead of after all fed buffers.

Closes gh-31747
2023-12-06 14:31:05 +01:00
Arjen Poutsma ef4ffa0005 Support empty part in DefaultPartHttpMessageReader
This commit fixes a bug in DefaultPartHttpMessageReader's
MultipartParser, due to which the last token in a part window was not
properly indicated.

Closes gh-30953
2023-12-06 12:21:37 +01:00
Yanming Zhou afcd03bddc Replace assertThat(x.isEmpty()).isTrue() with assertThat(x).isEmpty()
Search for   : assertThat\((.+).isEmpty\(\)\).isTrue\(\)
Replace with : assertThat($1).isEmpty()

Search for   : assertThat\((.+).isEmpty\(\)\).isFalse\(\)
Replace with : assertThat($1).isNotEmpty()

Closes gh-31758
2023-12-06 10:04:56 +01:00
Yanming Zhou 7b16ef90f1 Replace assertThat(x.equals(y)) with assertThat(x).isEqualTo(y)
Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isTrue\(\)
Replace with : assertThat($1).isEqualTo($2)

Search for   : assertThat\((.+)\.equals\((\w+)\)\)\.isFalse\(\)
Replace with : assertThat($1).isNotEqualTo($2)

Closes gh-31763
2023-12-06 09:50:15 +01:00
Yanming Zhou 59815cefce Replace assertThat(x.get(i)). with assertThat(x).element(i).
Search for   : assertThat\((.+)\.get\((\d+)\)\)\.
Replace with : assertThat($1).element($2).

Closes gh-31759
2023-12-06 09:43:59 +01:00
Sam Brannen c74d60b9fe Polishing 2023-12-05 16:14:13 +01:00
Sam Brannen db48813181 Polish contribution
See gh-31757
2023-12-05 16:14:13 +01:00
Yanming Zhou 6f11716b6f Use idiomatic AssertJ map assertions
See gh-31752
2023-12-05 10:01:38 +01:00
Sam Brannen 62b3d7a963 Update copyright headers 2023-12-04 16:47:25 +01:00
Yanming Zhou 490b5c77fc Use switch expression where feasible 2023-12-04 15:42:55 +01:00
Patrick Strawderman 7cdacf3083 Introduce toString(Charset) in FastByteArrayOutputStream
This commit introduces a toString() overload in
FastByteArrayOutputStream that accepts a Charset in order to mirror the
method that was introduced in ByteArrayOutputStream in JDK 10,
including a special case for when a single buffer is in use internally
to avoid the need to resize.

This commit also updates getContentAsString() in
ContentCachingRequestWrapper to use this new toString(Charset) method.

Closes gh-31737
2023-12-02 16:31:28 +01:00
Sam Brannen 47cdc7c5f0 Update copyright headers
See gh-31738
2023-12-02 15:32:46 +01:00
dogglezz decb22a93d Polish Javadoc
Closes gh-31738
2023-12-02 15:31:39 +01:00
Arjen Poutsma d204dd2dbe Use IntrospectingClientHttpResponse in RestClient
This commit ensures that the RestClient uses the
IntrospectingClientHttpResponse to verify whether the response has a
body, and return null if it does not.

See gh-12671
Closes gh-31719
2023-12-01 14:22:58 +01:00
Patrick Strawderman e452c2e89c Avoid byte array copy in getContentAsString
The getContentAsString method was originally added in d9b8826 to avoid
the extra copying inherent to calling ByteArrayOutputStream.toByteArray;
however, in f83c609 the class was updated to instead use
FastByteArrayOutputStream, and in the process the extra copy was brought
back when getContentAsString was changed to call toByteArray.

Switch to calling toByteArrayUnsafe, a method provided by
FastByteArrayOutputStream, which avoids the extra copy; since we
immediately pass the byte array to the String constructor, and it isn't
accessed anywhere else, the usage is safe.

See gh-31731
2023-12-01 10:47:38 +01:00
Sam Brannen 6ea9fdbf77 Polishing 2023-11-30 19:04:59 +01:00
rstoyanchev 8090a52f5c ForwardedHeaderFilter supports ERROR requestUri attribute
Closes gh-30828
2023-11-30 13:10:17 +00:00
rstoyanchev 19bca03aa2 Polishing in ForwardedHeaderFilter
See gh-30828
2023-11-30 13:10:17 +00:00
rstoyanchev 8ca82120e0 Add missing exception name to DisconnectedClientHelper
Closes gh-31717
2023-11-30 13:10:17 +00:00
rstoyanchev 9ade52dbe2 Exclude Part and MultipartFile from nested constructor binding
Closes gh-31669
2023-11-30 13:10:17 +00:00
Brian Clozel 35fcbae8c6 Fix reactive HTTP server Observation instrumentation
Prior to this commit, regressions were introduced with gh-31417:

1. the observation keyvalues would be inconsistent with the HTTP response
2. the observation scope would not cover all controller handlers, causing
  traceIds to be missing

The first issue is caused by the fact that in case of error signals, the
observation was stopped before the response was fully committed, which
means further processing could happen and update the response status.
This commit delays the stop event until the response is committed in
case of errors.

The second problem is caused by the change from a `contextWrite`
operator to using the `tap` operator with a `SignalListener`. The
observation was started in the `doOnSubscription` callback, which is too
late in some cases. If the WebFlux controller handler is synchronous
non-blocking, the execution of the handler is performed before the
subscription happens. This means that for those handlers, the
observation was not started, even if the current observation was
present in the reactor context. This commit changes the
`doOnSubscription` to `doFirst` to ensure that the observation is
started at the right time.

Fixes gh-31703
Fixes gh-31706
2023-11-29 14:39:56 +01:00
Sam Brannen 657b1c6455 Document need for -parameters flag in exception messages
Closes gh-31675
2023-11-25 14:53:56 +01:00
Stéphane Nicoll 487dbf8140 Polish "Polish RestClient Javadoc"
See gh-31659
2023-11-23 12:59:03 +01:00
johannesrost e95f8d2922 Polish RestClient Javadoc
See gh-31659
2023-11-23 12:38:16 +01:00
Brian Clozel d50b51e312 Fix ordering of releasing resources in JSON Encoder
Prior to this commit, the Jackson 2.x encoders, in case of encoding a
stream of data, would first release the `ByteArrayBuilder` and then the
`JsonGenerator`. This order is inconsistent with the single value
variant (see `o.s.h.codec.json.AbstractJackson2Encoder#encodeValue`) and
invalid since the `JsonGenerator` uses internally the
`ByteArrayBuilder`.

In case of a CSV Encoder, the codec can buffer data to write the column
names of the CSV file. Writing an empty Flux with this Encoder would not
fail but still log a NullPointerException ignored by the reactive
pipeline.

This commit fixes the order and avoid such issues at runtime.

Fixes gh-30493
2023-11-22 18:21:06 +01:00
Sébastien Deleuze 441e210533 Treat kotlin.Unit as void in web controllers
This commit fixes a regression introduced by gh-21139
via the usage of Kotlin reflection to invoke HTTP
handler methods. It ensures that kotlin.Unit is treated
as void by returning null.

It also polishes CoroutinesUtils to have a consistent
handling compared to the regular case, and adds related
tests to prevent future regressions.

Closes gh-31648
2023-11-22 13:45:03 +01:00
Arjen Poutsma e6ab8a6d61 Remove attributes from RestClient
This commit removes any references to attributes from RestClient, which
were left by mistake.

Closes gh-31625
2023-11-21 16:12:06 +01:00
Juergen Hoeller 99378fe947 Polishing 2023-11-16 11:22:09 +01:00
Brian Clozel c02f735056 Merge branch '6.0.x' 2023-11-16 09:04:09 +01:00
Brian Clozel c18784678d Reduce allocations in server conventions
This commit optimizes the default observation conventions to reduce
`KeyValues` allocations.
2023-11-16 09:00:24 +01:00
Stéphane Nicoll f15b8b95ad Merge branch '6.0.x' 2023-11-15 19:04:11 +01:00
Stéphane Nicoll 4464251754 Add missing runtime hints for ProblemDetail mixins
Closes gh-31606
2023-11-15 18:44:17 +01:00
Arjen Poutsma 8f21479234 Add body conversion capabilities in RestClient::exchange
This commit introduces a ConvertibleClientHttpResponse type that
extends ClientHttpResponse, and that can convert the body to a desired
type. Before this commit, it was not easy to use the configured HTTP
message converters in combination with RestClient::exchange.

Closes gh-31597
2023-11-14 11:18:59 +01:00
Stéphane Nicoll 7f615fd8af Fix reference in deprecation message of parseForwardedFor 2023-11-11 18:05:36 +01:00
Sébastien Deleuze 38724a1205 Fix RestClient generic type handling
For client side use case, the context class should be null,
consistently with what is done in HttpMessageConverterExtractor.

Closes gh-31574
2023-11-09 08:50:31 +01:00
rstoyanchev ba4d459f81 Merge branch '6.0.x' 2023-11-08 11:47:18 +00:00
rstoyanchev 5c012bbb0c Set maxAge correctly when expiring WebSession
Closes gh-31214
2023-11-08 11:44:36 +00:00
Stéphane Nicoll d34b3c1a71 Merge branch '6.0.x' 2023-11-08 08:04:27 +01:00
Johnny Lim cafb38ad1d Add Javadoc since to ProblemDetail.setProperties()
See gh-31571
2023-11-08 08:02:57 +01:00
Arjen Poutsma 5afb00d270 Merge branch '6.0.x' 2023-11-07 15:10:59 +01:00
Arjen Poutsma dc26d3b0ec Defer cleanup in DefaultServerWebExchange
This commit ensures that the multipartRead flag is read in a deferred
block, and is not evaluated too early.

Closes gh-31567
2023-11-07 15:00:20 +01:00
Arjen Poutsma 486503bd31 Buffer writes in JettyClientHttpRequest
This commit ensures that not every OutputStream.write gets written as a
separate chunk, by buffering the written data in a BufferedOutputStream.
In some cases, a large quantity of small writes would result in many
sent chunks.

Closes gh-31361
2023-11-07 14:02:01 +01:00
Arjen Poutsma 0839f5b749 Test form submissions
See gh-31361
2023-11-07 12:27:31 +01:00
rstoyanchev 5df6e8825d Polishing in CookieWebSessionIdResolver
See gh-31214
2023-11-06 11:31:39 +00:00
Arjen Poutsma efb93ca109 Fix bug in calculation of maximum form part size
See gh-31343
2023-11-06 11:20:18 +01:00
rstoyanchev 654e822676 Fix Javadoc link 2023-11-03 14:38:53 +00:00
Arjen Poutsma 6dd93d4d85 Allow repeatable writes in HttpMessageConverter
This commit ensures that the StreamingHttpOutputMessage.Body.repeatable
flag is set in message converters for bodies that can be written
repeatedly.

Closes gh-31516
See gh-31449
2023-11-02 15:51:36 +01:00
rstoyanchev f16122d533 Polishing and minor refactoring
Closes gh-31202
2023-11-02 11:32:03 +00:00
Carl-Eric Menzel d54a694f5a Add handler for unknown status codes
See gh-31202
2023-11-02 11:32:03 +00:00
Johnny Lim 2b750926c3 Polishing
Closes gh-31522
2023-10-30 15:05:20 +01:00
Arjen Poutsma 66aac7e359 Add maxParts and maxPartSize to PartEventHttpMessageReader
This commit introduces the maxParts and maxPartSize properties to
PartEventHttpMessageReader, which can be used to limit the amount of
parts, and maximum part size respectively.

Closes gh-31343
2023-10-25 15:18:35 +02:00
Rob Winch 03d286c4a1 Document X-Forwarded-* Headers
Previously the documentation assumed that the readers knew how to use
the X-Forwarded-* headers. This commit documents details & examples
of how to use the X-Forwarded-* headers.

See gh-31491
2023-10-25 13:22:41 +01:00
Sébastien Deleuze 3b80f2c4cb Refine MaxUploadSizeExceededException handling
This commit refines MaxUploadSizeExceededException
handling in order to translate to a "413 Payload Too Large"
status code instead of "500 Internal Server Error", with
related ProblemDetail body.

Closes gh-27170
2023-10-25 12:11:53 +02:00
Sébastien Deleuze a71eb3fb08 Merge branch '6.0.x' 2023-10-24 17:56:06 +02:00
Arjen Poutsma b6e0b8c343 Use StreamingHttpOutputMessage.Body.repeatable in OkHttp3ClientHttpRequest
See gh-31449
2023-10-24 16:12:26 +02:00
rstoyanchev 3f8bbdb116 Merge branch '6.0.x' 2023-10-24 12:53:55 +01:00
rstoyanchev 5c6b9be3a1 Send 400 for PathVariable that is null after conversion
This implies a value was actually sent, but is not something
that can be converted to the expected type.

Closes gh-31382
2023-10-24 12:53:25 +01:00
rstoyanchev 796080abb8 Test for change to add conversion of defaultValue
This commit adds a test and polishing for a change in
AbstractNamedValueMethodArgumentResolver erroneously committed
with (unrelated) commit e57b942b.

If an argument becomes null after conversion and a default value is
applied, that default value should also pass through conversion.

Closes gh-31336
2023-10-24 12:24:03 +01:00
Arjen Poutsma e0ac000415 Allow repeatable writes in StreamingHttpOutputMessage
This commit adds a repeatable property to
StreamingHttpOutputMessage.Body, indicating that the body can be written
 multiple times. In HttpComponentsClientHttpRequest, this property is
 exposed via org.apache.hc.core5.http.HttpEntity.isRepeatable, to allow
 for redirects.

Closes gh-31449
2023-10-24 12:11:13 +02:00
rstoyanchev e57b942b4d MockMvcBuilder supports filter name in addition to initParams
Closes gh-31474
2023-10-24 10:33:58 +01:00
Arjen Poutsma cb4d44b83e JdkClientHttpRequest does not support Content-Length 0
This commit ensures the correct HttpRequest.BodyPublisher is used with
Content-Length 0.

Closes gh-31451
2023-10-23 12:25:10 +02:00
Sam Brannen 2d792f000a Polish "Apply SingleSpaceSeparator Checkstyle module"
See gh-31469
2023-10-22 14:18:18 +02:00
Johnny Lim 64e9fcad53 Apply SingleSpaceSeparator Checkstyle module
This commit also fixes its violations.

Closes gh-31469
2023-10-22 14:09:57 +02:00
Sam Brannen 37e6fe5b64 Update copyright headers 2023-10-22 11:28:40 +02:00
Brian Clozel 31a62ff8ba Add JMH benchmarks for Protobuf message converter
This commit re-generates the protobuf Java classes with a recent version
of the protoc binary and adds JMH benchmarks that exercise the message
converter for both the reading and writing cases.

See gh-29496
2023-10-20 16:35:21 +02:00
Brian Clozel 631a5d1dc1 Remove support for Protobuf 2.x and protobuf-java-format
Closes gh-31465
2023-10-20 15:05:02 +02:00
rstoyanchev 7271dfed68 Use CopyOnWriteArrayList for beforeCommit actions
Closes gh-27587
2023-10-20 13:21:09 +01:00
rstoyanchev a8019f2d0b Create reusable DisconnectedClientHelper
See gh-26181
2023-10-17 15:52:24 +01:00