public abstract class AbstractView extends Object implements View, org.springframework.context.ApplicationContextAware
View
implementations.Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger that is available to subclasses
|
Constructor and Description |
---|
AbstractView() |
Modifier and Type | Method and Description |
---|---|
org.springframework.context.ApplicationContext |
getApplicationContext() |
Charset |
getDefaultCharset()
Return the default charset, used when the
content type does not contain one.
|
protected Map<String,Object> |
getModelAttributes(Map<String,?> model,
org.springframework.web.server.ServerWebExchange exchange)
Prepare the model to use for rendering.
|
List<org.springframework.http.MediaType> |
getSupportedMediaTypes()
Return the configured media types supported by this view.
|
reactor.core.publisher.Mono<Void> |
render(Map<String,?> model,
org.springframework.http.MediaType contentType,
org.springframework.web.server.ServerWebExchange exchange)
Prepare the model to render.
|
protected abstract reactor.core.publisher.Mono<Void> |
renderInternal(Map<String,Object> renderAttributes,
org.springframework.http.MediaType contentType,
org.springframework.web.server.ServerWebExchange exchange)
Subclasses must implement this method to actually render the view.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setDefaultCharset(Charset defaultCharset)
Set the default charset for this view, used when the
content type does not contain one.
|
void |
setSupportedMediaTypes(List<org.springframework.http.MediaType> supportedMediaTypes)
Set the supported media types for this view.
|
String |
toString() |
protected final Log logger
public void setSupportedMediaTypes(List<org.springframework.http.MediaType> supportedMediaTypes)
public List<org.springframework.http.MediaType> getSupportedMediaTypes()
getSupportedMediaTypes
in interface View
public void setDefaultCharset(Charset defaultCharset)
public Charset getDefaultCharset()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
public org.springframework.context.ApplicationContext getApplicationContext()
public reactor.core.publisher.Mono<Void> render(Map<String,?> model, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)
render
in interface View
model
- Map with name Strings as keys and corresponding model
objects as values (Map can also be null
in case of empty model)contentType
- the content type selected to render with which should
match one of the supported media types
.exchange
- the current exchangeMono
to represent when and if rendering succeedsprotected Map<String,Object> getModelAttributes(Map<String,?> model, org.springframework.web.server.ServerWebExchange exchange)
The default implementation creates a combined output Map that includes model as well as static attributes with the former taking precedence.
protected abstract reactor.core.publisher.Mono<Void> renderInternal(Map<String,Object> renderAttributes, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)
renderAttributes
- combined output Map (never null
),
with dynamic values taking precedence over static attributescontentType
- the content type selected to render with which should
match one of the supported media types
.exchange
- current exchange @return Mono
to represent when and if rendering succeeds