Class AbstractUrlBasedView

java.lang.Object
org.springframework.web.reactive.result.view.AbstractView
org.springframework.web.reactive.result.view.AbstractUrlBasedView
All Implemented Interfaces:
Aware, BeanNameAware, InitializingBean, ApplicationContextAware, View
Direct Known Subclasses:
FreeMarkerView, RedirectView, ScriptTemplateView

public abstract class AbstractUrlBasedView extends AbstractView implements InitializingBean
Abstract base class for URL-based views. Provides a consistent way of holding the URL that a View wraps, in the form of a "url" bean property.
Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • AbstractUrlBasedView

      protected AbstractUrlBasedView()
      Constructor for use as a bean.
    • AbstractUrlBasedView

      protected AbstractUrlBasedView(String url)
      Create a new AbstractUrlBasedView with the given URL.
  • Method Details

    • setUrl

      public void setUrl(@Nullable String url)
      Set the URL of the resource that this view wraps. The URL must be appropriate for the concrete View implementation.
    • getUrl

      public @Nullable String getUrl()
      Return the URL of the resource that this view wraps.
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Description copied from interface: InitializingBean
      Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

      This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
    • checkResourceExists

      public abstract boolean checkResourceExists(Locale locale) throws Exception
      Check whether the resource for the configured URL actually exists.
      Parameters:
      locale - the desired Locale that we're looking for
      Returns:
      false if the resource exists false if we know that it does not exist
      Throws:
      Exception - if the resource exists but is invalid (for example, could not be parsed)
    • resourceExists

      public reactor.core.publisher.Mono<Boolean> resourceExists(Locale locale)
      Deferred check whether the resource for the configured URL actually exists.

      The default implementation calls checkResourceExists(Locale).

      Parameters:
      locale - the desired Locale that we're looking for
      Returns:
      false if the resource exists false if we know that it does not exist
      Since:
      6.1
    • toString

      public String toString()
      Overrides:
      toString in class AbstractView