Top Description Fields Constructors Methods
org.springframework.web.servlet.view

public abstract Class AbstractUrlBasedView

extends AbstractView
implements InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean
Known Direct Subclasses
org.springframework.web.servlet.view.InternalResourceView, org.springframework.web.servlet.view.RedirectView, org.springframework.web.servlet.view.document.AbstractPdfStamperView, org.springframework.web.servlet.view.script.ScriptTemplateView, org.springframework.web.servlet.view.xslt.XsltView, org.springframework.web.servlet.view.AbstractTemplateView
Imports
java.util.Locale, org.springframework.beans.factory.InitializingBean, org.springframework.lang.Nullable

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.
Author
Juergen Hoeller
Since
13.12.2003

Field Summary

Modifier and TypeField and Description
private String
Inherited from org.springframework.web.servlet.view.AbstractView:
DEFAULT_CONTENT_TYPE

Constructor Summary

AccessConstructor and Description
protected
AbstractUrlBasedView()

Constructor for use as a bean.

protected
AbstractUrlBasedView(String
the URL to forward to
url
)

Create a new AbstractUrlBasedView with the given URL.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

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.

public boolean

Returns:

true if the resource exists (or is assumed to exist); false if we know that it does not exist
checkResource
(Locale
the desired Locale that we're looking for
locale
)

Check whether the underlying resource that the configured URL points to actually exists.

public String
getUrl()

Return the URL of the resource that this view wraps.

protected boolean
isUrlRequired()

Return whether the 'url' property is required.

public void
setUrl(String url)

Set the URL of the resource that this view wraps.

public String
toString()

Overrides org.springframework.web.servlet.view.AbstractView.toString.

Returns a string representation of the object.

Inherited from org.springframework.web.servlet.view.AbstractView:
addStaticAttributecreateMergedOutputModelcreateRequestContextcreateTemporaryOutputStreamexposeModelAsRequestAttributesformatViewNamegeneratesDownloadContentgetAttributesMapgetBeanNamegetContentTypegetRequestContextAttributegetRequestToExposegetStaticAttributesisExposePathVariablesprepareResponserenderrenderMergedOutputModelsetAttributessetAttributesCSVsetAttributesMapsetBeanNamesetContentTypesetExposeContextBeansAsAttributessetExposedContextBeanNamessetExposePathVariablessetRequestContextAttributesetResponseContentTypewriteToResponse

Field Detail

urlback to summary
private String url
Annotations
@Nullable

Constructor Detail

AbstractUrlBasedViewback to summary
protected AbstractUrlBasedView()

Constructor for use as a bean.

AbstractUrlBasedViewback to summary
protected AbstractUrlBasedView(String url)

Create a new AbstractUrlBasedView with the given URL.

Parameters
url:String

the URL to forward to

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet() throws Exception

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

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.

Annotations
@Override
Exceptions
Exception:
in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
checkResourceback to summary
public boolean checkResource(Locale locale) throws Exception

Check whether the underlying resource that the configured URL points to actually exists.

Parameters
locale:Locale

the desired Locale that we're looking for

Returns:boolean

true if the resource exists (or is assumed to exist); false if we know that it does not exist

Exceptions
Exception:
if the resource exists but is invalid (e.g. could not be parsed)
getUrlback to summary
public String getUrl()

Return the URL of the resource that this view wraps.

Annotations
@Nullable
isUrlRequiredback to summary
protected boolean isUrlRequired()

Return whether the 'url' property is required.

The default implementation returns true. This can be overridden in subclasses.

setUrlback to summary
public void setUrl(String url)

Set the URL of the resource that this view wraps. The URL must be appropriate for the concrete View implementation.

toStringback to summary
public String toString()

Overrides org.springframework.web.servlet.view.AbstractView.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override