@Requires(beans=ViewsRenderer.class) @Filter(value="/**") public class ViewsFilter extends java.lang.Object implements io.micronaut.http.filter.HttpServerFilter
Modifier and Type | Field and Description |
---|---|
protected io.micronaut.context.BeanLocator |
beanLocator |
protected java.lang.Integer |
order |
Constructor and Description |
---|
ViewsFilter(io.micronaut.context.BeanLocator beanLocator,
ViewsFilterOrderProvider viewsFilterOrderProvider)
Deprecated.
|
ViewsFilter(io.micronaut.context.BeanLocator beanLocator,
ViewsFilterOrderProvider viewsFilterOrderProvider,
java.util.Collection<ViewModelProcessor> viewModelProcessors)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> |
doFilter(io.micronaut.http.HttpRequest<?> request,
io.micronaut.http.filter.ServerFilterChain chain) |
int |
getOrder() |
protected java.util.Map<java.lang.String,java.lang.Object> |
populateModel(io.micronaut.http.HttpRequest request,
ViewsRenderer viewsRenderer,
java.lang.Object responseBody)
Resolves the model for the given response body and enhances the model with instances of
ViewModelProcessor . |
protected ModelAndView<java.util.Map<java.lang.String,java.lang.Object>> |
processModelAndView(io.micronaut.http.HttpRequest request,
java.lang.String view,
java.util.Map<java.lang.String,java.lang.Object> model) |
protected java.lang.Object |
resolveModel(java.lang.Object responseBody)
Resolves the model for the given response body.
|
protected java.util.Optional<java.lang.String> |
resolveView(io.micronaut.core.annotation.AnnotationMetadata route,
java.lang.Object responseBody)
Resolves the view for the given method and response body.
|
protected final java.lang.Integer order
protected final io.micronaut.context.BeanLocator beanLocator
public ViewsFilter(io.micronaut.context.BeanLocator beanLocator, @Nullable ViewsFilterOrderProvider viewsFilterOrderProvider, java.util.Collection<ViewModelProcessor> viewModelProcessors)
beanLocator
- The bean locatorviewsFilterOrderProvider
- The order providerviewModelProcessors
- Collection of views model decorator beans@Deprecated public ViewsFilter(io.micronaut.context.BeanLocator beanLocator, @Nullable ViewsFilterOrderProvider viewsFilterOrderProvider)
ViewsFilter(BeanLocator, ViewsFilterOrderProvider, Collection)
instead.beanLocator
- The bean locatorviewsFilterOrderProvider
- The order providerpublic int getOrder()
getOrder
in interface io.micronaut.core.order.Ordered
public final org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> doFilter(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.filter.ServerFilterChain chain)
doFilter
in interface io.micronaut.http.filter.HttpServerFilter
protected ModelAndView<java.util.Map<java.lang.String,java.lang.Object>> processModelAndView(io.micronaut.http.HttpRequest request, java.lang.String view, java.util.Map<java.lang.String,java.lang.Object> model)
request
- The HTTP Request being processedview
- The resolved View.model
- The Model returnedModelAndView
after being processed by the available ViewModelProcessor
s.protected java.util.Map<java.lang.String,java.lang.Object> populateModel(io.micronaut.http.HttpRequest request, ViewsRenderer viewsRenderer, java.lang.Object responseBody)
ViewModelProcessor
.request
- HttpRequest
being processedviewsRenderer
- The Views rendered being used to render the viewresponseBody
- Response Bodyprotected java.lang.Object resolveModel(java.lang.Object responseBody)
responseBody
- Response bodyprotected java.util.Optional<java.lang.String> resolveView(io.micronaut.core.annotation.AnnotationMetadata route, java.lang.Object responseBody)
route
- Request routeresponseBody
- Response body