@Requires(beans=ViewsRenderer.class) @Filter(value="/**") public class ViewsFilter extends Object implements HttpServerFilter
Modifier and Type | Field and Description |
---|---|
protected BeanLocator |
beanLocator |
protected Integer |
order |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
ViewsFilter(BeanLocator beanLocator,
ViewsFilterOrderProvider viewsFilterOrderProvider)
Deprecated.
|
ViewsFilter(BeanLocator beanLocator,
ViewsFilterOrderProvider viewsFilterOrderProvider,
Collection<ViewModelProcessor> viewModelProcessors)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Publisher<MutableHttpResponse<?>> |
doFilter(HttpRequest<?> request,
ServerFilterChain chain)
Variation of the
HttpServerFilter.doFilter(HttpRequest, FilterChain) method that accepts a ServerFilterChain
which allows to mutate the outgoing HTTP response. |
int |
getOrder() |
protected Map<String,Object> |
populateModel(HttpRequest request,
ViewsRenderer viewsRenderer,
Object responseBody)
Resolves the model for the given response body and enhances the model with instances of
ViewModelProcessor . |
protected ModelAndView<Map<String,Object>> |
processModelAndView(HttpRequest request,
String view,
Map<String,Object> model) |
protected Object |
resolveModel(Object responseBody)
Resolves the model for the given response body.
|
protected Optional<String> |
resolveView(AnnotationMetadata route,
Object responseBody)
Resolves the view for the given method and response body.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
doFilter
protected final Integer order
protected final BeanLocator beanLocator
public ViewsFilter(BeanLocator beanLocator, @Nullable ViewsFilterOrderProvider viewsFilterOrderProvider, Collection<ViewModelProcessor> viewModelProcessors)
beanLocator
- The bean locatorviewsFilterOrderProvider
- The order providerviewModelProcessors
- Collection of views model decorator beans@Deprecated public ViewsFilter(BeanLocator beanLocator, @Nullable ViewsFilterOrderProvider viewsFilterOrderProvider)
ViewsFilter(BeanLocator, ViewsFilterOrderProvider, Collection)
instead.beanLocator
- The bean locatorviewsFilterOrderProvider
- The order providerpublic int getOrder()
public final Publisher<MutableHttpResponse<?>> doFilter(HttpRequest<?> request, ServerFilterChain chain)
HttpServerFilter
HttpServerFilter.doFilter(HttpRequest, FilterChain)
method that accepts a ServerFilterChain
which allows to mutate the outgoing HTTP response.doFilter
in interface HttpServerFilter
request
- The requestchain
- The chainPublisher
that emits a MutableHttpResponse
HttpServerFilter.doFilter(HttpRequest, FilterChain)
protected ModelAndView<Map<String,Object>> processModelAndView(HttpRequest request, String view, Map<String,Object> model)
request
- The HTTP Request being processedview
- The resolved View.model
- The Model returnedModelAndView
after being processed by the available ViewModelProcessor
s.protected Map<String,Object> populateModel(HttpRequest request, ViewsRenderer viewsRenderer, Object responseBody)
ViewModelProcessor
.request
- HttpRequest
being processedviewsRenderer
- The Views rendered being used to render the viewresponseBody
- Response Bodyprotected Object resolveModel(Object responseBody)
responseBody
- Response bodyprotected Optional<String> resolveView(AnnotationMetadata route, Object responseBody)
route
- Request routeresponseBody
- Response body