32
32
import org .springframework .util .Assert ;
33
33
34
34
/**
35
- * Public API for HTML rendering from a collection or from a stream of
36
- * {@link Fragment}s each with its own view and model. For use with
37
- * view technologies such as <a href="https://htmx.org/">htmx</a> where multiple
38
- * page fragments may be rendered in a single response. Supported as a return
39
- * value from a WebFlux controller method .
35
+ * Public API for HTML rendering of a collection of fragments each with a view
36
+ * and independent model. For use with frontends technologies such as
37
+ * <a href="https://htmx.org/">htmx</a> where multiple page fragments may be
38
+ * rendered in one response. Supported as a return value from Spring WebFlux
39
+ * controller methods .
40
40
*
41
41
* <p>For full page rendering with a single model and view, use {@link Rendering}.
42
42
*
@@ -74,8 +74,8 @@ static Builder with(String viewName, Map<String, Object> model) {
74
74
}
75
75
76
76
/**
77
- * Create a builder and add a fragment with a view name only, also
78
- * inheriting model attributes from the model for the request.
77
+ * Variant of {@link #with(String, Map)} with a view name only, but also
78
+ * inheriting model attributes from the shared model for the request.
79
79
* @param viewName the name of the view for the fragment
80
80
* @return this builder
81
81
*/
@@ -84,14 +84,20 @@ static Builder with(String viewName) {
84
84
}
85
85
86
86
/**
87
- * Create a builder to render with a collection of Fragments.
87
+ * Variant of {@link #with(String, Map)} with a collection of fragments.
88
+ * @param fragments the fragments to add; each fragment also inherits model
89
+ * attributes from the shared model for the request
90
+ * @return the created builder
88
91
*/
89
92
static Builder withCollection (Collection <Fragment > fragments ) {
90
93
return new DefaultFragmentsRenderingBuilder (fragments );
91
94
}
92
95
93
96
/**
94
- * Create a builder to render with a {@link Publisher} of Fragments.
97
+ * Variant of {@link #with(String, Map)} with a {@link Publisher} of fragments.
98
+ * @param fragmentsPublisher the fragments to add; each fragment also
99
+ * inherits model attributes from the shared model for the request
100
+ * @return the created builder
95
101
*/
96
102
static <P extends Publisher <Fragment >> Builder withPublisher (P fragmentsPublisher ) {
97
103
return new DefaultFragmentsRenderingBuilder (fragmentsPublisher );
@@ -126,7 +132,7 @@ interface Builder {
126
132
Builder status (HttpStatusCode status );
127
133
128
134
/**
129
- * Add the given, single header value under the given name.
135
+ * Add one or more header values under the given name.
130
136
* @param headerName the header name
131
137
* @param headerValues the header value(s)
132
138
* @return this builder
@@ -151,15 +157,16 @@ interface Builder {
151
157
Builder fragment (String viewName , Map <String , Object > model );
152
158
153
159
/**
154
- * Add a fragment with a view name only, inheriting model attributes from
155
- * the model for the request.
160
+ * Variant of {@link #fragment(String, Map)} with a view name only, where
161
+ * the fragment model also inherits model attributes from the shared
162
+ * model for the request.
156
163
* @param viewName the name of the view for the fragment
157
164
* @return this builder
158
165
*/
159
166
Builder fragment (String viewName );
160
167
161
168
/**
162
- * Add a fragment.
169
+ * Variant of {@link # fragment(String, Map)} with a {@link Fragment} .
163
170
* @param fragment the fragment to add
164
171
* @return this builder
165
172
*/
0 commit comments