|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractCachingViewResolver
org.springframework.web.servlet.view.ResourceBundleViewResolver
public class ResourceBundleViewResolver
Implementation of ViewResolver that uses bean definitions in a ResourceBundle, specified by the bundle basename. The bundle is typically defined in a properties file, located in the class path. The default bundle basename is "views".
This ViewResolver supports localized view definitions, using the
default support of java.util.PropertyResourceBundle.
Note: This ViewResolver implements the Ordered interface to allow for flexible participation in ViewResolver chaining. For example, some special views could be defined via this ViewResolver (giving it 0 as "order" value), while all remaining views could be resolved by a UrlBasedViewResolver.
ResourceBundle.getBundle(java.lang.String),
PropertyResourceBundle,
UrlBasedViewResolver| Field Summary | |
|---|---|
static String |
DEFAULT_BASENAME
Default if no other basename is supplied |
| Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
ResourceBundleViewResolver()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Invoked by a BeanFactory on destruction of a singleton. |
int |
getOrder()
Return the order value of this object, higher value meaning greater in terms of sorting. |
protected BeanFactory |
initFactory(Locale locale)
Initialize the BeanFactory from the ResourceBundle, for the given locale. |
protected View |
loadView(String viewName,
Locale locale)
Subclasses must implement this method. |
void |
setBasename(String basename)
Set the basename, as defined in the java.util.ResourceBundle documentation. |
void |
setBasenames(String[] basenames)
Set multiple ResourceBundle basenames. |
void |
setDefaultParentView(String defaultParentView)
Set the default parent for views defined in the ResourceBundle. |
void |
setOrder(int order)
|
| Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver |
|---|
createView, getCacheKey, isCache, removeFromCache, resolveViewName, setCache |
| Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
|---|
getServletContext, getTempDir, getWebApplicationContext, isContextRequired |
| Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
|---|
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_BASENAME
| Constructor Detail |
|---|
public ResourceBundleViewResolver()
| Method Detail |
|---|
public void setOrder(int order)
public int getOrder()
OrderedHigher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).
getOrder in interface Orderedpublic void setBasename(String basename)
The default is "views".
basename - the ResourceBundle basenamesetBasenames(java.lang.String[]),
ResourceBundlepublic void setBasenames(String[] basenames)
basenames - multiple ResourceBundle basenamessetBasename(java.lang.String)public void setDefaultParentView(String defaultParentView)
The parent will typically define the view class and common attributes. Concrete views might simply consist of an URL definition then: a la "yyy1.url=/my.jsp", "yyy2.url=/your.jsp".
View definitions that define their own parent or carry their own class can still override this. Strictly speaking, the rule that a default parent setting does not apply to a bean definition that carries a class is there for backwards compatiblity reasons. It still matches the typical use case.
defaultParentView - the default parent view
protected View loadView(String viewName,
Locale locale)
throws Exception
AbstractCachingViewResolverNot all subclasses may support internationalization: A subclass that doesn't can simply ignore the locale parameter.
NOTE: As of Spring 1.2, subclasses are supposed to fully initialize the View objects before returning them, also applying bean container initialization callbacks.
loadView in class AbstractCachingViewResolverviewName - the name of the view to retrievelocale - the Locale to retrieve the view for
Exception - if the view couldn't be resolvedAbstractCachingViewResolver.resolveViewName(java.lang.String, java.util.Locale)
protected BeanFactory initFactory(Locale locale)
throws Exception
Exception
public void destroy()
throws BeansException
DisposableBean
destroy in interface DisposableBeanBeansException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||