https://github.com/raphw/spring-stream-interop
Adds support for using InputStream/OutputStream from Spring's web clients
https://github.com/raphw/spring-stream-interop
Last synced: about 1 month ago
JSON representation
Adds support for using InputStream/OutputStream from Spring's web clients
- Host: GitHub
- URL: https://github.com/raphw/spring-stream-interop
- Owner: raphw
- Created: 2022-05-09T08:25:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-09T21:17:11.000Z (almost 4 years ago)
- Last Synced: 2026-02-20T00:50:05.084Z (2 months ago)
- Language: Java
- Size: 24.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Spring stream interoperability
==============================
This project offers three integrations:
1. A `WebClientHttpRequestFactory` that redirects the `RestTemplate` API calls to a `WebClient`. Doing so, it is possible to use any connector that is written for the `WebClient` also with `RestTemplate`and to use a single configuration for the client that underlies this web client.
2. A `JdkClientHttpRequestFactory` for the JDK HTTP client to work with `RestTemplate`: while rest template is not (no longer) officially deprecated, its development has become dormant. If the `RestTemplate` should be used alongside Spring's `WebClient`, this connector allows to use the same underlying client for both APIs.
3. Decoders and body inserters/extractors for streams: The `InputStreamDecoder` allows to map the result of a request through the `WebClient` to an `InputStream` that makes bytes available as they arrive. For this, it must be registered as a codec in the web client's builder, and the stream must be closed to avoid leaking data. Without a codec, it offers similar integrations to read bodys as streams via streams using `StreamBodyExtractors`. And body's can be written to a request using `StreamBodyInserters`.