@@ -110,9 +110,10 @@ of RxJava or other reactive library. See <<webflux-reactive-libraries>> for more
110
110
[[webflux-programming-models]]
111
111
=== Programming models
112
112
113
- The `spring-web` module contains the reactive foundation that underlies Spring WebFlux --
114
- HTTP abstractions, Reactive Streams server adapters, reactive codecs, and a
115
- core Web API whose role is comparable to the Servlet API but with non-blocking semantics.
113
+ The `spring-web` module contains the reactive foundation that underlies Spring WebFlux
114
+ including HTTP abstractions, Reactive Streams <<webflux-httphandler,adapters>> for supported
115
+ servers, <<webflux-codecs,codecs>>, and a core <<webflux-web-handler-api>> comparable to
116
+ the Servlet API but with non-blocking contracts.
116
117
117
118
On that foundation Spring WebFlux provides a choice of two programming models:
118
119
@@ -425,31 +426,34 @@ to have the following detected:
425
426
426
427
427
428
[[webflux-codecs]]
428
- === Codecs
429
+ === HTTP Message Codecs
430
+ [.small]#<<integration.adoc#rest-message-conversion,Same in Spring MVC>>#
429
431
430
- The `spring-web` module provides
432
+ The `spring-web` module defines the
431
433
{api-spring-framework}/http/codec/HttpMessageReader.html[HttpMessageReader] and
432
- {api-spring-framework}/http/codec/HttpMessageWriter.html[HttpMessageWriter]
433
- for encoding and decoding the HTTP request and response body with Reactive Streams.
434
- It builds on lower level contracts from `spring-core`:
435
-
436
- * {api-spring-framework}/core/io/buffer/DataBuffer.html[DataBuffer] -- abstraction for
437
- byte buffers -- e.g. Netty `ByteBuf`, `java.nio.ByteBuffer`, see
438
- <<core#databuffers, Data Buffers and Codecs>>.
439
- * {api-spring-framework}/core/codec/Encoder.html[Encoder] -- serialize a stream of Objects
440
- to a stream of data buffers
441
- * {api-spring-framework}/core/codec/Decoder.html[Decoder] -- deserialize a stream of data
442
- buffers into a stream of Objects
443
-
444
- Basic `Encoder` and `Decoder` implementations exist in `spring-core` but `spring-web` adds
445
- more for JSON, XML, and other formats. You can wrap any `Encoder` and `Decoder` as a reader
446
- or writer with `EncoderHttpMessageWriter` and `DecoderHttpMessageReader`. There are some
447
- additional, web-only reader and writer implementations for server-sent events, form data,
448
- and more.
449
-
450
- Finally, `ClientCodecConfigurer` and `ServerCodecConfigurer` can be used to initialize
451
- a list of readers and writers. They include support for classpath detection and a
452
- of defaults along with the ability to override or replace those defaults.
434
+ {api-spring-framework}/http/codec/HttpMessageWriter.html[HttpMessageWriter] contracts
435
+ for encoding and decoding the body of HTTP requests and responses via Rective Streams
436
+ ``Publisher``'s. These contacts are used on the client side, e.g. in the `WebClient`,
437
+ and on the server side, e.g. in annotated controllers and functional endpoints.
438
+
439
+ The `spring-core` module defines the
440
+ {api-spring-framework}/core/codec/Encoder.html[Encoder] and
441
+ {api-spring-framework}/core/codec/Decoder.html[Decoder] contracts that are independent of
442
+ HTTP and rely on the {api-spring-framework}/core/io/buffer/DataBuffer.html[DataBuffer]
443
+ contract that abstracts different byte buffer representations such as the Netty `ByteBuf`
444
+ and `java.nio.ByteBuffer` (see <<core#databuffers, Data Buffers and Codecs>>).
445
+ An `Encoder` can be wrapped with `EncoderHttpMessageWriter` to be used as an
446
+ `HttpMessageWriter` while a `Decoder` can be wrapped with `DecoderHttpMessageReader` to
447
+ be used as an `HttpMessageReader`.
448
+
449
+ The `spring-core` module contains basic `Encoder` and `Decoder` implementations for
450
+ `byte[]`, `ByteBuffer`, `DataBuffer`, `Resource`, and `String`. The `spring-web` module
451
+ adds ``Encoder``'s and ``Decoder``'s for Jackson JSON, Jackson Smile, and JAXB2.
452
+ The `spring-web` module also contains some web-specific readers and writers for
453
+ server-sent events, form data, and multipart requests.
454
+
455
+ To configure or customize the readers and writers to use applications will typically use
456
+ `ClientCodecConfigurer` or `ServerCodecConfigurer`.
453
457
454
458
455
459
0 commit comments