Package io.micronaut.views
Class ViewsFilter
java.lang.Object
io.micronaut.views.ViewsFilter
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,io.micronaut.http.filter.HttpFilter
,io.micronaut.http.filter.HttpServerFilter
@Requires(beans=ViewsResolver.class)
@Filter("/**")
public class ViewsFilter
extends Object
implements io.micronaut.http.filter.HttpServerFilter
Templates Filter.
- Since:
- 1.0
- Author:
- Sergio del Amo
-
Field Summary
Modifier and TypeFieldDescriptionprotected final TurboFrameRenderer
Turbo Stream Renderer.protected final TurboStreamRenderer
Turbo Stream Renderer.protected final ViewsModelDecorator
Views Model Decorator.protected final ViewsRendererLocator
Views Render Locator.protected final ViewsResolver
Views Resolver.Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionViewsFilter
(ViewsResolver viewsResolver, ViewsRendererLocator viewsRendererLocator, ViewsModelDecorator viewsModelDecorator, TurboFrameRenderer turboFrameRenderer) Constructor.ViewsFilter
(ViewsResolver viewsResolver, ViewsRendererLocator viewsRendererLocator, ViewsModelDecorator viewsModelDecorator, TurboStreamRenderer turboStreamRenderer, TurboFrameRenderer turboFrameRenderer) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>
doFilter
(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.filter.ServerFilterChain chain) int
getOrder()
protected io.micronaut.http.MediaType
resolveMediaType
(@NonNull io.micronaut.http.HttpResponse<?> response, @Nullable Object responseBody) Deprecated, for removal: This API element is subject to removal in a future version.UseresolveMediaType(HttpRequest, HttpResponse, Object)
instead.protected @NonNull io.micronaut.http.MediaType
resolveMediaType
(@Nullable io.micronaut.http.HttpRequest<?> request, @NonNull io.micronaut.http.HttpResponse<?> response, @Nullable Object responseBody) Resolves the response content type for the matched route.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.filter.HttpServerFilter
doFilter
-
Field Details
-
viewsResolver
Views Resolver. -
viewsRendererLocator
Views Render Locator. -
viewsModelDecorator
Views Model Decorator. -
turboStreamRenderer
Turbo Stream Renderer. -
turboFrameRenderer
Turbo Stream Renderer.
-
-
Constructor Details
-
ViewsFilter
@Inject public ViewsFilter(ViewsResolver viewsResolver, ViewsRendererLocator viewsRendererLocator, ViewsModelDecorator viewsModelDecorator, TurboFrameRenderer turboFrameRenderer) Constructor.- Parameters:
viewsResolver
- Views ResolverviewsRendererLocator
- ViewRendererLocatorviewsModelDecorator
- Views Model DecoratorturboFrameRenderer
- Turbo Frame renderer
-
ViewsFilter
@Deprecated(forRemoval=true, since="4.1.0") public ViewsFilter(ViewsResolver viewsResolver, ViewsRendererLocator viewsRendererLocator, ViewsModelDecorator viewsModelDecorator, TurboStreamRenderer turboStreamRenderer, TurboFrameRenderer turboFrameRenderer) Deprecated, for removal: This API element is subject to removal in a future version.Constructor.- Parameters:
viewsResolver
- Views ResolverviewsRendererLocator
- ViewRendererLocatorviewsModelDecorator
- Views Model DecoratorturboStreamRenderer
- Turbo Stream rendererturboFrameRenderer
- Turbo Frame renderer
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceio.micronaut.core.order.Ordered
-
doFilter
public final org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> doFilter(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.filter.ServerFilterChain chain) - Specified by:
doFilter
in interfaceio.micronaut.http.filter.HttpServerFilter
-
resolveMediaType
@NonNull protected @NonNull io.micronaut.http.MediaType resolveMediaType(@Nullable @Nullable io.micronaut.http.HttpRequest<?> request, @NonNull @NonNull io.micronaut.http.HttpResponse<?> response, @Nullable @Nullable Object responseBody) Resolves the response content type for the matched route.- Parameters:
request
- HTTP Requestresponse
- HTTP responseresponseBody
- HTTP Response body- Returns:
- The resolved content type
-
resolveMediaType
@Deprecated(forRemoval=true, since="4.1.0") protected io.micronaut.http.MediaType resolveMediaType(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response, @Nullable @Nullable Object responseBody) Deprecated, for removal: This API element is subject to removal in a future version.UseresolveMediaType(HttpRequest, HttpResponse, Object)
instead.Resolves the response content type for the matched route.- Parameters:
response
- HTTP responseresponseBody
- HTTP Response body- Returns:
- The resolved content type
-
ViewsFilter(io.micronaut.views.ViewsResolver,io.micronaut.views.ViewsRendererLocator,io.micronaut.views.ViewsModelDecorator,io.micronaut.views.turbo.TurboFrameRenderer)
instead.