Class DefaultViewsResolver

java.lang.Object
io.micronaut.views.DefaultViewsResolver
All Implemented Interfaces:
ViewsResolver

@Singleton @Requires(classes=io.micronaut.http.HttpRequest.class) public class DefaultViewsResolver extends Object implements ViewsResolver
Default implementation of ViewsResolver. It checks if the route is annotated with View or returns a ModelAndView instance.
Since:
3.0.0
Author:
Sergio del Amo
  • Constructor Details

    • DefaultViewsResolver

      public DefaultViewsResolver()
  • Method Details

    • resolveView

      @NonNull public @NonNull Optional<String> resolveView(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.HttpResponse<?> response)
      Specified by:
      resolveView in interface ViewsResolver
      Parameters:
      request - HTTP Request
      response - HTTP Response
      Returns:
      The view name if resolved
    • resolveView

      protected Optional<String> resolveView(io.micronaut.core.annotation.AnnotationMetadata route, @Nullable @Nullable Object responseBody)
      Resolves the view for the given method and response body. Subclasses can override to customize.
      Parameters:
      route - Request route
      responseBody - Response body
      Returns:
      view name to be rendered