|
|
|
@ -147,7 +147,6 @@ public abstract class AbstractView implements View, ApplicationContextAware {
@@ -147,7 +147,6 @@ public abstract class AbstractView implements View, ApplicationContextAware {
|
|
|
|
|
* Obtain the ApplicationContext for actual use. |
|
|
|
|
* @return the ApplicationContext (never {@code null}) |
|
|
|
|
* @throws IllegalStateException in case of no ApplicationContext set |
|
|
|
|
* @since 5.0 |
|
|
|
|
*/ |
|
|
|
|
protected final ApplicationContext obtainApplicationContext() { |
|
|
|
|
ApplicationContext applicationContext = getApplicationContext(); |
|
|
|
@ -191,7 +190,9 @@ public abstract class AbstractView implements View, ApplicationContextAware {
@@ -191,7 +190,9 @@ public abstract class AbstractView implements View, ApplicationContextAware {
|
|
|
|
|
* <p>The default implementation creates a combined output Map that includes |
|
|
|
|
* model as well as static attributes with the former taking precedence. |
|
|
|
|
*/ |
|
|
|
|
protected Mono<Map<String, Object>> getModelAttributes(@Nullable Map<String, ?> model, ServerWebExchange exchange) { |
|
|
|
|
protected Mono<Map<String, Object>> getModelAttributes(@Nullable Map<String, ?> model, |
|
|
|
|
ServerWebExchange exchange) { |
|
|
|
|
|
|
|
|
|
int size = (model != null ? model.size() : 0); |
|
|
|
|
|
|
|
|
|
Map<String, Object> attributes = new LinkedHashMap<>(size); |
|
|
|
@ -203,9 +204,11 @@ public abstract class AbstractView implements View, ApplicationContextAware {
@@ -203,9 +204,11 @@ public abstract class AbstractView implements View, ApplicationContextAware {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* By default, resolve async attributes supported by the {@link ReactiveAdapterRegistry} to their blocking counterparts. |
|
|
|
|
* <p>View implementations capable of taking advantage of reactive types can override this method if needed. |
|
|
|
|
* @return {@code Mono} to represent when the async attributes have been resolved |
|
|
|
|
* By default, resolve async attributes supported by the |
|
|
|
|
* {@link ReactiveAdapterRegistry} to their blocking counterparts. |
|
|
|
|
* <p>View implementations capable of taking advantage of reactive types |
|
|
|
|
* can override this method if needed. |
|
|
|
|
* @return {@code Mono} for the completion of async attributes resolution |
|
|
|
|
*/ |
|
|
|
|
protected Mono<Void> resolveAsyncAttributes(Map<String, Object> model) { |
|
|
|
|
|
|
|
|
@ -252,8 +255,9 @@ public abstract class AbstractView implements View, ApplicationContextAware {
@@ -252,8 +255,9 @@ public abstract class AbstractView implements View, ApplicationContextAware {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create a RequestContext to expose under the specified attribute name. |
|
|
|
|
* <p>The default implementation creates a standard RequestContext instance for the |
|
|
|
|
* given request and model. Can be overridden in subclasses for custom instances. |
|
|
|
|
* <p>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 |
|
|
|
@ -269,7 +273,8 @@ public abstract class AbstractView implements View, ApplicationContextAware {
@@ -269,7 +273,8 @@ public abstract class AbstractView implements View, ApplicationContextAware {
|
|
|
|
|
* <p>The default implementation looks in the {@link #getApplicationContext() |
|
|
|
|
* Spring configuration} 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 RequestDataValueProcessor, or null if there is none at the |
|
|
|
|
* application context. |
|
|
|
|
*/ |
|
|
|
|
@Nullable |
|
|
|
|
protected RequestDataValueProcessor getRequestDataValueProcessor() { |
|
|
|
@ -286,7 +291,8 @@ public abstract class AbstractView implements View, ApplicationContextAware {
@@ -286,7 +291,8 @@ public abstract class AbstractView implements View, ApplicationContextAware {
|
|
|
|
|
* 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 exchange current exchange @return {@code Mono} to represent when |
|
|
|
|
* and if rendering succeeds |
|
|
|
|
*/ |
|
|
|
|
protected abstract Mono<Void> renderInternal(Map<String, Object> renderAttributes, |
|
|
|
|
@Nullable MediaType contentType, ServerWebExchange exchange); |
|
|
|
|