Commit Graph

1459 Commits

Author SHA1 Message Date
Arjen Poutsma
a03a116f6b Force TokenBuffer to use BigDecimal if elementtype
This commit makes the Jackson2Tokenizer enable
TokenBuffer.forceUseOfBigDecimal if the element type given to the
Decoder is BigDecimal. Previous to this commit, values would be
converted to floats.

Closes gh-24479
2020-02-07 14:16:21 +01:00
Arjen Poutsma
45555f77a6 Honour ObjectMapper feature in Jackson2Tokenizer
After this commit, Jackson2Tokenizer honours ObjectMapper's
DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS feature when creating
TokenBuffers.

Closes gh-24479
2020-02-07 10:45:00 +01:00
Rossen Stoyanchev
ba5fc21ab4 Option to pair AnnotationIntrospector instances
Closes gh-22830
2020-02-05 20:49:07 +00:00
Rossen Stoyanchev
cc4261c30b Only non-null input resets scheme specific part
Closes gh-24444
2020-01-30 06:16:43 +00:00
Rossen Stoyanchev
542e187831 Expose media type mappings in ContentNegotiationManager
ContentNegotiationManagerFactoryBean now ensures that
ContentNegotiationManager contains the MediaType mappings even if the
path extension and the parameter strategies are off.

There are also minor fixes to ensure the media type mappings in
ContentNegotiationManagerFactoryBean aren't polluted when mapping keys
are not lowercase, and likewise MappingMediaTypeFileExtensionResolver
filters out duplicates in the list of all file extensions.

See gh-24179
2020-01-22 13:35:09 +00:00
Arjen Poutsma
54669c51c9 Use Jackson SequenceWriter for streaming
Before this commit, the AbstractJackson2Encoder instantiated a
ObjectWriter per value. This is not an issue for single values or
non-streaming scenarios (which effectively are the same, because in the
latter values are collected into a list until offered to Jackson).
However, this does create a problem for SMILE, because it allows for
shared references that do not match up when writing each value with a
new ObjectWriter, resulting in errors parsing the result.

This commit uses Jackson's SequenceWriter for streaming scenarios,
allowing Jackson to reuse the same context for writing multiple values,
fixing the issue described above.

Closes gh-24198
2020-01-21 14:22:00 +01:00
Rossen Stoyanchev
5e9d29d813 Ability to customize default Smile codecs
Closes gh-24382
2020-01-20 17:29:59 +00:00
Rossen Stoyanchev
5d8c5b0d9b Avoid NPE on comment SSE event
Closes gh-24389
2020-01-20 11:26:58 +00:00
Sam Brannen
1c270d8d06 Fix Checkstyle violation 2020-01-13 18:21:36 +01:00
Rossen Stoyanchev
29fe65d23c Upgrade to Dysprosium snapshots
See gh-24349
2020-01-13 16:49:42 +00:00
Rossen Stoyanchev
cbc57460b7 Support for maxInMemorySize in SSE reader
Closes gh-24312
2020-01-13 14:57:14 +00:00
Rossen Stoyanchev
08e9372ded Restore response after beforeCommit action errors
See gh-24186
2020-01-09 11:10:44 +00:00
Rossen Stoyanchev
01827389ef Polishing contribution
See gh-24292
2020-01-08 16:19:25 +00:00
Oleh Faizulin
e96b71acf3 contentLength support for Resource decoding
Expose the known content length, if known, in the InputStreamResource returned by ResourceHttpMessageConverter or
ResourceDecoder.

See gh-24292
2020-01-08 16:19:11 +00:00
Rossen Stoyanchev
9d963abb7d Concrete MediaType check in StringHttpMessageConverter
Closes gh-23287
2020-01-07 15:02:39 +00:00
Brian Clozel
f9c1565f4e Remove Content-* response headers for error handling
Prior to this commit, when WebFlux handlers added `"Content-*"` response
headers and an error happened while handling the request, all those
headers would not be cleared from the response before error handling.

This commit clears those headers from the response in two places:
* when invoking the handler and adapting the response
* when writing the response body

Not removing those headers might break HTTP clients since they're given
wrong information about how to interpret the HTTP response body: the
error response body might be very different from the original one.

Fixes gh-24238
2020-01-06 16:55:08 +01:00
Sam Brannen
7b6d83a106 Use Gradle test fixture support for spring-web
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
726b1bb1d0 Rename test fixture package in spring-context
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
7cd4ddf5fc Rename test fixture package in spring-beans
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen
4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen
61d4ee594d Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen
5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Rossen Stoyanchev
956ffe6858 ContentDisposition refactoring
See gh-24220
2019-12-26 17:30:15 +00:00
Rossen Stoyanchev
15321a3163 Fix checkstyle violations 2019-12-19 13:06:53 +00:00
Rossen Stoyanchev
41f40c6c22 Escape quotes in filename
Closes gh-24220
2019-12-19 12:23:12 +00:00
Rossen Stoyanchev
0eacb443b0 Reuse InputStream in ResourceRegionHttpMessageConverter
The converter now tries to keep reading from the same InputStream which
should be possible with ordered and non-overlapping regions. When
necessary the InputStream is re-opened.

Closes gh-24214
2019-12-18 16:22:53 +00:00
Rossen Stoyanchev
b23617637d Fix cloning issue in CodecConfigurer for multipart writers
Closes gh-24194
2019-12-12 21:58:14 +00:00
Rossen Stoyanchev
11e321b8e7 Add register methods to CodecConfigurer.CustomCodecs
The new register methods replace the now deprecated
encoder, decoder, reader, and writer methods, and also offer a choice
to opt into default properties such maxInMemorySize, if configured.

See gh-24124
2019-12-12 21:58:14 +00:00
Rossen Stoyanchev
9d65830133 CodecConfigurer implementation refactoring
See gh-24124
2019-12-12 21:57:45 +00:00
Rossen Stoyanchev
9b30d46ff4 JSON charset handling in StringHttpMessageConverter
This commit restores the interpretation of JSON as UTF-8 by default that
was removed in #bc205e0 and also ensures a charset is not appended
automatically to "application/json".

Closes gh-24123
2019-12-10 16:52:23 +00:00
Rossen Stoyanchev
c8bce9686f ContentDisposition trims charset in filename
Closes gh-24112
2019-12-10 15:38:28 +00:00
Rossen Stoyanchev
1b172c1d20 Expose localAddress in WebFlux server
Closes gh-24174
2019-12-10 15:10:13 +00:00
Johnny Lim
1e83e889aa Use hasSize() where possible
See gh-24172
2019-12-10 07:58:53 +01:00
Brian Clozel
21053780ef Polish 2019-12-02 23:13:44 +01:00
Rossen Stoyanchev
acfeb77d41 Polishing
See gh-23961
2019-12-02 14:12:59 +00:00
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
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
395c1e415c Polishing contribution
See gh-24074
2019-11-29 15:54:58 +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
Johnny Lim
4aa013c508 Remove duplicate checks in ResponseCookieTests 2019-11-28 07:15:15 +00:00
Rossen Stoyanchev
70a3dbff24 WebSession creation does not block
Closes gh-24027
2019-11-26 10:48:39 +00:00
Christoph Dreis
b234c77b67 Add missing verify() in EncoderHttpMessageWriterTests
Closes gh-24062
2019-11-25 10:51:00 +00:00
Rossen Stoyanchev
7bed4f36da Add missing verify() in Jackson2TokenizerTests
Closes gh-24056
2019-11-22 16:38:43 +00:00
Rossen Stoyanchev
21b2fc1f01 Improve HttpHandlerConnection completion
Before this commit the connector waited for a completed response (via
ServerHttpResponse#setComplete or ServerHttpResponse#writeWith) or an
error signal in handling, but it didn't deal explicitly with the case
where both can occur.

This commit explicitly waits for the completion of handling (success
or error) before passing the response downstream. If an error occurs
after response completion, it is wrapped in a dedicated exception that
also provides access to the completed response.

Close gh-24051
2019-11-22 10:28:05 +00:00
Rossen Stoyanchev
f4e0288357 Remove mentions of Tomcat async request timeout value
Close gh-24030
2019-11-19 17:08:43 +00:00
Juergen Hoeller
1607f1db0b Fix Checkstyle nohttp violation 2019-11-15 10:50:28 +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
Rossen Stoyanchev
04aa3d05da Refactor solution for respones error details
See gh-1956
2019-11-13 14:24:12 +00:00