diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java index 4234df9f31c..4090982ae65 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/AbstractView.java @@ -47,6 +47,7 @@ import org.springframework.web.server.ServerWebExchange; * Base class for {@link View} implementations. * * @author Rossen Stoyanchev + * @author Sam Brannen * @since 5.0 */ public abstract class AbstractView implements View, BeanNameAware, ApplicationContextAware { @@ -86,7 +87,7 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo /** * Set the supported media types for this view. - * Default is "text/html;charset=UTF-8". + *
Default is {@code "text/html;charset=UTF-8"}.
*/
public void setSupportedMediaTypes(List Default is {@linkplain StandardCharsets#UTF_8 UTF 8}.
*/
public void setDefaultCharset(Charset defaultCharset) {
Assert.notNull(defaultCharset, "'defaultCharset' must not be null");
@@ -113,7 +114,7 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
}
/**
- * Return the default charset, used when the
+ * Get the default charset, used when the
* {@linkplain #setSupportedMediaTypes(List) content type} does not contain one.
*/
public Charset getDefaultCharset() {
@@ -121,15 +122,15 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
}
/**
- * Set the name of the RequestContext attribute for this view.
- * Default is none.
+ * Set the name of the {@code RequestContext} attribute for this view.
+ * Default is none ({@code null}).
*/
public void setRequestContextAttribute(@Nullable String requestContextAttribute) {
this.requestContextAttribute = requestContextAttribute;
}
/**
- * Return the name of the RequestContext attribute, if any.
+ * Get the name of the {@code RequestContext} attribute for this view, if any.
*/
@Nullable
public String getRequestContextAttribute() {
@@ -146,8 +147,8 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
}
/**
- * Return the view's name. Should never be {@code null}, if the view was
- * correctly configured.
+ * Get the view's name.
+ * Should never be {@code null} if the view was correctly configured.
*/
@Nullable
public String getBeanName() {
@@ -165,9 +166,10 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
}
/**
- * Obtain the ApplicationContext for actual use.
- * @return the ApplicationContext (never {@code null})
- * @throws IllegalStateException in case of no ApplicationContext set
+ * Obtain the {@link ApplicationContext} for actual use.
+ * @return the {@code ApplicationContext} (never {@code null})
+ * @throws IllegalStateException if the ApplicationContext cannot be obtained
+ * @see #getApplicationContext()
*/
protected final ApplicationContext obtainApplicationContext() {
ApplicationContext applicationContext = getApplicationContext();
@@ -178,12 +180,12 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
/**
* Prepare the model to render.
- * @param model a Map with name Strings as keys and corresponding model
- * objects as values (Map can also be {@code null} in case of empty model)
- * @param contentType the content type selected to render with which should
- * match one of the {@link #getSupportedMediaTypes() supported media types}.
+ * @param model a map with attribute names as keys and corresponding model
+ * objects as values (the map can also be {@code null} in case of an empty model)
+ * @param contentType the content type selected to render with, which should
+ * match one of the {@link #getSupportedMediaTypes() supported media types}
* @param exchange the current exchange
- * @return {@code Mono} to represent when and if rendering succeeds
+ * @return a {@code Mono} that represents when and if rendering succeeds
*/
@Override
public Mono The default implementation creates a standard RequestContext instance
- * for the given request and model. Can be overridden in subclasses for
- * custom instances.
- * @param exchange current exchange
- * @param model combined output Map (never {@code null}),
- * with dynamic values taking precedence over static attributes
- * @return the RequestContext instance
+ * Create a {@link RequestContext} to expose under the
+ * {@linkplain #setRequestContextAttribute specified attribute name}.
+ * The default implementation creates a standard {@code RequestContext}
+ * instance for the given exchange and model.
+ * Can be overridden in subclasses to create custom instances.
+ * @param exchange the current exchange
+ * @param model a combined output Map (never {@code null}), with dynamic values
+ * taking precedence over static attributes
+ * @return the {@code RequestContext} instance
* @see #setRequestContextAttribute
*/
protected RequestContext createRequestContext(ServerWebExchange exchange, Map The default implementation looks in the {@link #getApplicationContext()
- * Spring configuration} for a {@code RequestDataValueProcessor} bean with
+ * ApplicationContext} for a {@code RequestDataValueProcessor} bean with
* the name {@link #REQUEST_DATA_VALUE_PROCESSOR_BEAN_NAME}.
- * @return the RequestDataValueProcessor, or null if there is none at the
- * application context.
+ * @return the {@code RequestDataValueProcessor}, or {@code null} if there is
+ * none in the application context
*/
@Nullable
protected RequestDataValueProcessor getRequestDataValueProcessor() {
@@ -343,10 +346,10 @@ public abstract class AbstractView implements View, BeanNameAware, ApplicationCo
* Subclasses must implement this method to actually render the view.
* @param renderAttributes combined output Map (never {@code null}),
* with dynamic values taking precedence over static attributes
- * @param contentType the content type selected to render with which should
- * match one of the {@link #getSupportedMediaTypes() supported media types}.
- *@param exchange current exchange @return {@code Mono} to represent when
- * and if rendering succeeds
+ * @param contentType the content type selected to render with, which should
+ * match one of the {@linkplain #getSupportedMediaTypes() supported media types}
+ * @param exchange current exchange
+ * @return a {@code Mono} that represents when and if rendering succeeds
*/
protected abstract Mono>} and then wait to
* resolve them into actual values. When the returned {@code Mono