4747 * Base class for {@link View} implementations.
4848 *
4949 * @author Rossen Stoyanchev
50+ * @author Sam Brannen
5051 * @since 5.0
5152 */
5253public abstract class AbstractView implements View , BeanNameAware , ApplicationContextAware {
@@ -86,7 +87,7 @@ public AbstractView(ReactiveAdapterRegistry reactiveAdapterRegistry) {
8687
8788 /**
8889 * Set the supported media types for this view.
89- * Default is "text/html;charset=UTF-8".
90+ * <p> Default is {@code "text/html;charset=UTF-8"} .
9091 */
9192 public void setSupportedMediaTypes (List <MediaType > supportedMediaTypes ) {
9293 Assert .notEmpty (supportedMediaTypes , "MediaType List must not be empty" );
@@ -95,7 +96,7 @@ public void setSupportedMediaTypes(List<MediaType> supportedMediaTypes) {
9596 }
9697
9798 /**
98- * Return the configured media types supported by this view.
99+ * Get the configured media types supported by this view.
99100 */
100101 @ Override
101102 public List <MediaType > getSupportedMediaTypes () {
@@ -105,31 +106,31 @@ public List<MediaType> getSupportedMediaTypes() {
105106 /**
106107 * Set the default charset for this view, used when the
107108 * {@linkplain #setSupportedMediaTypes(List) content type} does not contain one.
108- * Default is {@linkplain StandardCharsets#UTF_8 UTF 8}.
109+ * <p> Default is {@linkplain StandardCharsets#UTF_8 UTF 8}.
109110 */
110111 public void setDefaultCharset (Charset defaultCharset ) {
111112 Assert .notNull (defaultCharset , "'defaultCharset' must not be null" );
112113 this .defaultCharset = defaultCharset ;
113114 }
114115
115116 /**
116- * Return the default charset, used when the
117+ * Get the default charset, used when the
117118 * {@linkplain #setSupportedMediaTypes(List) content type} does not contain one.
118119 */
119120 public Charset getDefaultCharset () {
120121 return this .defaultCharset ;
121122 }
122123
123124 /**
124- * Set the name of the RequestContext attribute for this view.
125- * Default is none.
125+ * Set the name of the {@code RequestContext} attribute for this view.
126+ * <p> Default is none ({@code null}) .
126127 */
127128 public void setRequestContextAttribute (@ Nullable String requestContextAttribute ) {
128129 this .requestContextAttribute = requestContextAttribute ;
129130 }
130131
131132 /**
132- * Return the name of the RequestContext attribute, if any.
133+ * Get the name of the {@code RequestContext} attribute for this view , if any.
133134 */
134135 @ Nullable
135136 public String getRequestContextAttribute () {
@@ -146,8 +147,8 @@ public void setBeanName(@Nullable String beanName) {
146147 }
147148
148149 /**
149- * Return the view's name. Should never be {@code null}, if the view was
150- * correctly configured.
150+ * Get the view's name.
151+ * <p>Should never be {@code null} if the view was correctly configured.
151152 */
152153 @ Nullable
153154 public String getBeanName () {
@@ -165,9 +166,10 @@ public ApplicationContext getApplicationContext() {
165166 }
166167
167168 /**
168- * Obtain the ApplicationContext for actual use.
169- * @return the ApplicationContext (never {@code null})
170- * @throws IllegalStateException in case of no ApplicationContext set
169+ * Obtain the {@link ApplicationContext} for actual use.
170+ * @return the {@code ApplicationContext} (never {@code null})
171+ * @throws IllegalStateException if the ApplicationContext cannot be obtained
172+ * @see #getApplicationContext()
171173 */
172174 protected final ApplicationContext obtainApplicationContext () {
173175 ApplicationContext applicationContext = getApplicationContext ();
@@ -178,12 +180,12 @@ protected final ApplicationContext obtainApplicationContext() {
178180
179181 /**
180182 * Prepare the model to render.
181- * @param model a Map with name Strings as keys and corresponding model
182- * objects as values (Map can also be {@code null} in case of empty model)
183- * @param contentType the content type selected to render with which should
184- * match one of the {@link #getSupportedMediaTypes() supported media types}.
183+ * @param model a map with attribute names as keys and corresponding model
184+ * objects as values (the map can also be {@code null} in case of an empty model)
185+ * @param contentType the content type selected to render with, which should
186+ * match one of the {@link #getSupportedMediaTypes() supported media types}
185187 * @param exchange the current exchange
186- * @return {@code Mono} to represent when and if rendering succeeds
188+ * @return a {@code Mono} that represents when and if rendering succeeds
187189 */
188190 @ Override
189191 public Mono <Void > render (@ Nullable Map <String , ?> model , @ Nullable MediaType contentType ,
@@ -239,9 +241,9 @@ protected Mono<Map<String, Object>> getModelAttributes(
239241 * Use the configured {@link ReactiveAdapterRegistry} to adapt asynchronous
240242 * attributes to {@code Mono<T>} or {@code Mono<List<T>>} and then wait to
241243 * resolve them into actual values. When the returned {@code Mono<Void>}
242- * completes, the asynchronous attributes in the model would have been
244+ * completes, the asynchronous attributes in the model will have been
243245 * replaced with their corresponding resolved values.
244- * @return result {@code Mono} that completes when the model is ready
246+ * @return result a {@code Mono} that completes when the model is ready
245247 * @since 5.1.8
246248 */
247249 protected Mono <Void > resolveAsyncAttributes (Map <String , Object > model , ServerWebExchange exchange ) {
@@ -299,7 +301,7 @@ private void addBindingResult(String name, Object value, Map<String, Object> mod
299301 * replaced with their corresponding resolved values.
300302 * @return result {@code Mono} that completes when the model is ready
301303 * @deprecated as of 5.1.8 this method is still invoked but it is a no-op.
302- * Please, use {@link #resolveAsyncAttributes(Map, ServerWebExchange)}
304+ * Please use {@link #resolveAsyncAttributes(Map, ServerWebExchange)}
303305 * instead. It is invoked after this one and does the actual work.
304306 */
305307 @ Deprecated
@@ -308,27 +310,28 @@ protected Mono<Void> resolveAsyncAttributes(Map<String, Object> model) {
308310 }
309311
310312 /**
311- * Create a RequestContext to expose under the specified attribute name.
312- * <p>The default implementation creates a standard RequestContext instance
313- * for the given request and model. Can be overridden in subclasses for
314- * custom instances.
315- * @param exchange current exchange
316- * @param model combined output Map (never {@code null}),
317- * with dynamic values taking precedence over static attributes
318- * @return the RequestContext instance
313+ * Create a {@link RequestContext} to expose under the
314+ * {@linkplain #setRequestContextAttribute specified attribute name}.
315+ * <p>The default implementation creates a standard {@code RequestContext}
316+ * instance for the given exchange and model.
317+ * <p>Can be overridden in subclasses to create custom instances.
318+ * @param exchange the current exchange
319+ * @param model a combined output Map (never {@code null}), with dynamic values
320+ * taking precedence over static attributes
321+ * @return the {@code RequestContext} instance
319322 * @see #setRequestContextAttribute
320323 */
321324 protected RequestContext createRequestContext (ServerWebExchange exchange , Map <String , Object > model ) {
322325 return new RequestContext (exchange , model , obtainApplicationContext (), getRequestDataValueProcessor ());
323326 }
324327
325328 /**
326- * Return the {@link RequestDataValueProcessor} to use.
329+ * Get the {@link RequestDataValueProcessor} to use.
327330 * <p>The default implementation looks in the {@link #getApplicationContext()
328- * Spring configuration } for a {@code RequestDataValueProcessor} bean with
331+ * ApplicationContext } for a {@code RequestDataValueProcessor} bean with
329332 * the name {@link #REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME}.
330- * @return the RequestDataValueProcessor, or null if there is none at the
331- * application context.
333+ * @return the {@code RequestDataValueProcessor} , or {@code null} if there is
334+ * none in the application context
332335 */
333336 @ Nullable
334337 protected RequestDataValueProcessor getRequestDataValueProcessor () {
@@ -343,10 +346,10 @@ protected RequestDataValueProcessor getRequestDataValueProcessor() {
343346 * Subclasses must implement this method to actually render the view.
344347 * @param renderAttributes combined output Map (never {@code null}),
345348 * with dynamic values taking precedence over static attributes
346- * @param contentType the content type selected to render with which should
347- * match one of the {@link #getSupportedMediaTypes() supported media types}.
348- *@param exchange current exchange @return {@code Mono} to represent when
349- * and if rendering succeeds
349+ * @param contentType the content type selected to render with, which should
350+ * match one of the {@linkplain #getSupportedMediaTypes() supported media types}
351+ * @param exchange current exchange
352+ * @return a {@code Mono} that represents when and if rendering succeeds
350353 */
351354 protected abstract Mono <Void > renderInternal (Map <String , Object > renderAttributes ,
352355 @ Nullable MediaType contentType , ServerWebExchange exchange );
0 commit comments