Commit Graph

2543 Commits

Author SHA1 Message Date
Brian Clozel
d4209392d2 Allow ExchangeStrategies customizations in WebClient
Prior to this commit, developers could configure their WebClient to use
their custom `ExchangeStrategies`, by providing it in the
`WebClient.Builder` chain.
Once created, an `ExchangeStrategies` instance is not mutable, which
makes it hard for further customizations by other components. In the
case of the reported issue, other components would override the default
configuration for the codecs maxInMemorySize.

This commit makes the `ExchangeStrategies` mutable and uses that fact to
further customize them with a new `WebClient.Builder#exchangeStrategies`
`Consumer` variant. This commit is also deprecating those mutating
variants in favor of a new `WebClient.Builder#exchangeStrategies` that
takes a `ExchangeStrategies#Builder` directly and avoids mutation issues
altogether.

Closes gh-23961
2019-12-02 14:12:59 +00:00
Brian Clozel
1560bbd81e Revert "Allow ExchangeStrategies customizations in WebClient"
This reverts commit b3020bc484.
2019-12-02 10:39:53 +01:00
Juergen Hoeller
567c7695dd Polishing 2019-12-01 00:20:00 +01:00
Brian Clozel
b3020bc484 Allow ExchangeStrategies customizations in WebClient
Prior to this commit, developers could configure their WebClient to use
their custom `ExchangeStrategies`, by providing it in the
`WebClient.Builder` chain.
Once created, an `ExchangeStrategies` instance is not mutable, which
makes it hard for further customizations by other components. In the
case of the reported issue, other components would override the default
configuration for the codecs maxInMemorySize.

This commit makes the `ExchangeStrategies` mutable and uses that fact to
further customize them with a new `WebClient.Builder#exchangeStrategies`
`Consumer` variant. This commit is also deprecating those mutating
variants in favor of a new `WebClient.Builder#exchangeStrategies` that
takes a `ExchangeStrategies#Builder` directly and avoids mutation issues
altogether.

Closes gh-23961
2019-11-29 22:26:52 +01:00
Rossen Stoyanchev
25f3465f1f Polishing contribution
See gh-24087
2019-11-29 15:53:37 +00:00
Rossen Stoyanchev
b44daa8b71 Remove the few remaining usages of UriTemplate
Also update Javadoc of UriTemplate to point to UriComponentsBuilder and
UriBuilderFactory as more flexible options.

See gh-24094
2019-11-28 11:28:49 +00:00
Rossen Stoyanchev
df2ed75df0 MultipartBodyBuilder Javadoc update
Closes gh-24031
2019-11-28 10:40:28 +00:00
Rossen Stoyanchev
70a3dbff24 WebSession creation does not block
Closes gh-24027
2019-11-26 10:48:39 +00:00
Arjen Poutsma
ddb38eefee Expose method to determine form content type
This commit exposes the method that returns the media type used to write
forms. By default, it includes the charset in the content type, which
can cause issues with certain consumers. This commit changes the method
from a private to a protected method, so that users can override the
default behavior.

Closes: gh-22971
2019-11-26 10:50:08 +01:00
Arjen Poutsma
2d86f221ce Remove println 2019-11-25 18:27:34 +01:00
Arjen Poutsma
5f3c7ca559 Fix NullPointerException in Jackson2SmileDecoder
Fix uncommon case in Jackson2SmileDecoder, where a null token,
incicating a document separator in streaming mode, is followed by
NOT_AVAILABLE.

Closes gh-24009
2019-11-25 16:23:27 +01:00
Rossen Stoyanchev
51b35e64cf Extra isReady-onWritePossible after last write
Closes gh-24050
2019-11-22 15:57:21 +00:00
stsypanov
1f3b595a03 Use String.isEmpty() instead of String.equals("") 2019-11-21 16:42:01 +01:00
Sam Brannen
b4e1d48322 Ignore scoped proxy targets for @ControllerAdvice beans
Prior to this commit, methods in a @ControllerAdvice bean were
registered and invoked twice if the advice was a scoped bean (e.g.,
request or session scoped). In other words, both the proxy bean and the
target bean were wrapped in ControllerAdviceBean instances.

This commit fixes this bug by modifying the findAnnotatedBeans() method
in ControllerAdviceBean so that it filters out targets of scoped
proxies.

Closes gh-24017
2019-11-19 14:20:25 +01:00
Sam Brannen
3a39b7fe82 Support scoped @ControllerAdvice beans again
Spring Framework 5.2 introduced support for implementing the Ordered
interface in a @ControllerAdvice bean. This support requires that
@ControllerAdvice beans be eagerly resolved from the BeanFactory in
order to invoke the getOrder() method defined in the Ordered interface.
Unfortunately doing so resulted in a regression in that an attempt to
eagerly resolve a scoped @ControllerAdvice bean throws a
BeanCreationException due to the lack of an active scope (e.g., request
or session scope).

This commit fixes this regression by avoiding eager resolution of scoped
@ControllerAdvice beans. As a direct consequence, the Ordered interface
is not supported for scoped @ControllerAdvice beans.

Closes gh-23985
2019-11-18 22:29:00 +01:00
Rossen Stoyanchev
c33cb26a73 Polishing contribution
See gh-1885
2019-11-14 17:38:01 +00:00
Mark Hobson
46fe74d2f9 Preserve media type parameters when setting charset
Issue: SPR-17040
2019-11-14 17:38:01 +00:00
Juergen Hoeller
22211a01ce Polishing 2019-11-13 17:23:23 +01:00
Rossen Stoyanchev
2c1afca9c5 Reject null form data names
...or skip if there are no values either.

Closes gh-22372
2019-11-13 15:03:22 +00:00
Rossen Stoyanchev
04aa3d05da Refactor solution for respones error details
See gh-1956
2019-11-13 14:24:12 +00:00
jerzykrlk
91ec274b10 SPR-17130 http error details in the exception message 2019-11-13 14:24:12 +00:00
Arjen Poutsma
a7a88371e7 Allow for decode method to return null in AbstractJackson2Decoder
Prior to this commit, the decoder did not allow for a null value
returned from the Jackson object reader.

Closes: gh-23935
2019-11-11 16:48:30 +01:00
Juergen Hoeller
6d47e1e0a1 Fix getHeaderPredicate visibility to be declared as protected
Closes gh-23976
2019-11-11 15:55:06 +01:00
Rossen Stoyanchev
ffe69a51e1 Javadoc update for content negotiation
Closes gh-23409
2019-11-11 12:04:28 +00:00
Rossen Stoyanchev
1261e64465 Minor refactoring
Apply default Accept header for HttpUrlConnection only.

See gh-23855
2019-11-08 08:44:04 +00:00
Lorenzo Torracchi
afae8c3045 Avoid default "Accept" from HttpUrlConnection
Closes gh-23740
2019-11-08 08:43:25 +00:00
Arjen Poutsma
55f3f128c9 Polishing 2019-11-07 14:29:47 +01:00
Arjen Poutsma
bf36f49dc5 Corrupt multipart should not hang SynchronossPartHttpMessageReader
This commit notifies the Synchronoss listener that the buffer stream
has ended.

Closes gh-23768
2019-11-07 09:10:07 +01:00
Rossen Stoyanchev
3a241b546f Relax domain name checks in ResponseCookie
Closes gh-23924
2019-11-06 17:54:39 +00:00
Sam Brannen
92228f0fc0 Test status quo for @RequestHeader UUID conversion support
See gh-23939
2019-11-06 13:49:44 +01:00
AlexeyAnufriev
2d208de145 Clear connection pool for OkHttpClient
Closes gh-23628
2019-11-01 11:44:16 +00:00
Rossen Stoyanchev
fd9678833f Use int for maxParts instead of long 2019-10-31 14:13:44 +00:00
Brian Clozel
3b724c72b6 Polish
See gh-23884
2019-10-30 19:57:17 +01:00
Sam Brannen
9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Juergen Hoeller
19ff7d84ab Polishing 2019-10-30 14:31:46 +01:00
Juergen Hoeller
19107649d2 Revise concurrent JAXBContext creation towards computeIfAbsent
Closes gh-23879
2019-10-30 14:31:34 +01:00
Rossen Stoyanchev
422c26832b Minor follow-up to previous commit
See gh-23741
2019-10-30 12:38:26 +00:00
Rossen Stoyanchev
34cfbe5d26 ResponseStatusException associated headers
A ResponseStatus exception now exposes extra method to return headers
for the response. This is used in ResponseStatusExceptionHandler to
apply the headers to the response.

Closes gh-23741
2019-10-30 12:10:45 +00:00
Juergen Hoeller
046380988b Nullability refinements 2019-10-30 00:26:11 +01:00
Rossen Stoyanchev
5abf24e7d7 Expose maxInMemorySize via CodecConfigurer
Centralized maxInMemorySize exposed via CodecConfigurer along with
ability to plug in an instance of MultipartHttpMessageWrite.

Closes gh-23884
2019-10-29 12:33:16 +00:00
Rossen Stoyanchev
00ead7a756 Refine multipart parsing limits
See gh-23884
2019-10-29 12:33:16 +00:00
Brian Clozel
ea6f51e9e3 Configurable limits with Synchronoss
See gh-23884
2019-10-29 12:33:16 +00:00
Brian Clozel
69bcdfc17f Polishing 2019-10-29 12:33:16 +00:00
Rossen Stoyanchev
89d053d7f4 Limits on input stream in codecs
- Add maxInMemorySize property to Decoder and HttpMessageReader
  implementations that aggregate input to trigger
  DataBufferLimitException when reached.

- For codecs that call DataBufferUtils#join, there is now an overloaded
  variant with a maxInMemorySize extra argument. Internally, a custom
  LimitedDataBufferList is used to count and enforce the limit.

- Jackson2Tokenizer and XmlEventDecoder support those limits per
  streamed JSON object.

See gh-23884
2019-10-29 12:33:16 +00:00
Rossen Stoyanchev
780eef8d36 Update comment in HttpWebHandlerAdapter
See gh-23780
2019-10-23 17:31:59 +01:00
Johnny Lim
33bf09d513 Polish HttpWebHandlerAdapter.handleUnresolvedError() 2019-10-23 16:57:20 +01:00
Rossen Stoyanchev
2733511ea2 Charset argument in RestClientResponseException
See gh-23764
2019-10-23 16:49:32 +01:00
Rossen Stoyanchev
4932196b87 RestClientResponseException defaults to UTF-8
Closes gh-23764
2019-10-23 16:26:57 +01:00
Sam Brannen
112bbe859c Fix grammar in Javadoc 2019-10-22 18:07:41 +02:00
Brian Clozel
a65c6f6884 Fix APPLICATION_PROBLEM_JSON_UTF8 media type value
This commit adds the missing "+json" suffix to the "application/problem"
media type for its deprecated UTF-8 variant.

Fixes gh-23825
2019-10-17 09:36:05 +02:00