Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement binary support in JacksonConverterFactory #3411

Conversation

istvankovacs-priv
Copy link

@istvankovacs-priv istvankovacs-priv commented Jun 2, 2020

Closes #3403

What?

The JacksonConverterFactory now includes binary support.

Why?

Previously, the JacksonResponseBodyConverter relied on a charStream to convert the response body content, limiting its capability to handle binary data. This constraint necessitated text-formatted content for serialization, making it challenging to send binary data. Although workarounds existed, it is now possible to easily address this limitation by introducing support for binary data through the use of a custom ObjectMapper.

How?

  • Modified charStream to byteStream in the JacksonResponseBodyConverter.
  • Enabled change of mediaType through a constructor parameter in JacksonRequestBodyConverter.
  • Implemented an overload of the create function in JacksonConverterFactory, allowing the setting of mediaType through a nullable second parameter. This new function is called by other overloads to maintain backward compatibility.

@istvankovacs-priv istvankovacs-priv changed the title CBOR support implemented in JacksonConverterFactory Binary support implemented in JacksonConverterFactory Jun 2, 2020
@JakeWharton
Copy link
Member

This looks pretty good. Needs some tests though before we can merge to prevent regression. If you can't get to them then I will eventually.

@istvankovacs-priv
Copy link
Author

Many thanks for the review! Feel free to implement the tests.

@JakeWharton JakeWharton force-pushed the CBOR-support-in-jackson-converter-factory branch 4 times, most recently from 74de86a to 16541a0 Compare February 21, 2024 04:48
@JakeWharton JakeWharton force-pushed the CBOR-support-in-jackson-converter-factory branch from 16541a0 to 48b98a9 Compare February 21, 2024 04:51
@JakeWharton JakeWharton merged commit 921de4a into square:trunk Feb 21, 2024
7 checks passed
@istvankovacs-priv istvankovacs-priv changed the title Binary support implemented in JacksonConverterFactory Binary support implemented in JacksonConverterFactory Feb 28, 2024
@istvankovacs-priv istvankovacs-priv changed the title Binary support implemented in JacksonConverterFactory Implement binary support in JacksonConverterFactory Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support CBOR in JacksonConverterFactory
4 participants