Documentation updates for working with DataBuffers
Issue: SPR-17409
This commit is contained in:
@@ -204,6 +204,22 @@ class ExampleHandler implements WebSocketHandler {
|
||||
|
||||
|
||||
|
||||
[[webflux-websocket-databuffer]]
|
||||
=== `DataBuffer`
|
||||
|
||||
`DataBuffer` is the representation for a byte buffer in WebFlux. The Spring Core part of
|
||||
the reference has more on that in the section on
|
||||
<<core#databuffers,Data Buffers and Codecs>>. The key point to understand is that on some
|
||||
servers like Netty, byte buffers are pooled and reference counted, and must be released
|
||||
when consumed to avoid memory leaks.
|
||||
|
||||
When running on Netty, applications must use `DataBufferUtils.retain(dataBuffer)` if they
|
||||
wish to hold on input data buffers in order to ensure they are not released, and
|
||||
subsequently use `DataBufferUtils.release(dataBuffer)` when the buffers are consumed.
|
||||
|
||||
|
||||
|
||||
|
||||
[[webflux-websocket-server-handshake]]
|
||||
=== Handshake
|
||||
[.small]#<<web.adoc#websocket-server-handshake,Same as in the Servlet stack>>#
|
||||
|
||||
@@ -671,7 +671,7 @@ to encode and decode HTTP message content.
|
||||
application, while a `Decoder` can be wrapped with `DecoderHttpMessageReader`.
|
||||
* {api-spring-framework}/core/io/buffer/DataBuffer.html[`DataBuffer`] abstracts different
|
||||
byte buffer representations (e.g. Netty `ByteBuf`, `java.nio.ByteBuffer`, etc.) and is
|
||||
what all codecs work on. See <<core#databuffers, Data Buffers and Codecs>> in the
|
||||
what all codecs work on. See <<core#databuffers,Data Buffers and Codecs>> in the
|
||||
"Spring Core" section for more on this topic.
|
||||
|
||||
The `spring-core` module provides `byte[]`, `ByteBuffer`, `DataBuffer`, `Resource`, and
|
||||
@@ -741,7 +741,7 @@ consistently for access to the cached form data versus reading from the raw requ
|
||||
|
||||
|
||||
[[webflux-codecs-multipart]]
|
||||
==== Multipart Data
|
||||
==== Multipart
|
||||
|
||||
`MultipartHttpMessageReader` and `MultipartHttpMessageWriter` support decoding and
|
||||
encoding "multipart/form-data" content. In turn `MultipartHttpMessageReader` delegates to
|
||||
@@ -772,6 +772,24 @@ comment-only, empty SSE event or any other "no-op" data that would effectively s
|
||||
a heartbeat.
|
||||
|
||||
|
||||
[[webflux-codecs-buffers]]
|
||||
==== `DataBuffer`
|
||||
|
||||
`DataBuffer` is the representation for a byte buffer in WebFlux. The Spring Core part of
|
||||
the reference has more on that in the section on
|
||||
<<core#databuffers,Data Buffers and Codecs>>. The key point to understand is that on some
|
||||
servers like Netty, byte buffers are pooled and reference counted, and must be released
|
||||
when consumed to avoid memory leaks.
|
||||
|
||||
WebFlux applications generally do not need to be concerned with such issues, unless they
|
||||
consume or produce data buffers directly, as opposed to relying on codecs to convert to
|
||||
and from higher level objects. Or unless they choose to create custom codecs. For such
|
||||
cases please review the the information in <<core#databuffers,Data Buffers and Codecs>>,
|
||||
especially the section on <<core#databuffers-using,Using DataBuffer>>.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[[webflux-logging]]
|
||||
=== Logging
|
||||
|
||||
Reference in New Issue
Block a user