|
|
|
@ -36,24 +36,22 @@ import org.springframework.web.context.support.GenericWebApplicationContext; |
|
|
|
import org.springframework.web.servlet.View; |
|
|
|
import org.springframework.web.servlet.View; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* {@link org.springframework.web.servlet.ViewResolver} implementation |
|
|
|
* A {@link org.springframework.web.servlet.ViewResolver} implementation that uses |
|
|
|
* that uses bean definitions in a {@link ResourceBundle}, specified by |
|
|
|
* bean definitions in a {@link ResourceBundle}, specified by the bundle basename. |
|
|
|
* the bundle basename. |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
* <p>The bundle is typically defined in a properties file, located in |
|
|
|
* <p>The bundle is typically defined in a properties file, located in the classpath. |
|
|
|
* the class path. The default bundle basename is "views". |
|
|
|
* The default bundle basename is "views". |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>This {@code ViewResolver} supports localized view definitions, |
|
|
|
* <p>This {@code ViewResolver} supports localized view definitions, using the |
|
|
|
* using the default support of {@link java.util.PropertyResourceBundle}. |
|
|
|
* default support of {@link java.util.PropertyResourceBundle}. For example, the |
|
|
|
* For example, the basename "views" will be resolved as class path resources |
|
|
|
* basename "views" will be resolved as class path resources "views_de_AT.properties", |
|
|
|
* "views_de_AT.properties", "views_de.properties", "views.properties" - |
|
|
|
* "views_de.properties", "views.properties" - for a given Locale "de_AT". |
|
|
|
* for a given Locale "de_AT". |
|
|
|
|
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Note: this {@code ViewResolver} implements the {@link Ordered} |
|
|
|
* <p>Note: This {@code ViewResolver} implements the {@link Ordered} interface
|
|
|
|
* interface to allow for flexible participation in {@code ViewResolver} |
|
|
|
* in order to allow for flexible participation in {@code ViewResolver} chaining. |
|
|
|
* chaining. For example, some special views could be defined via this |
|
|
|
* For example, some special views could be defined via this {@code ViewResolver} |
|
|
|
* {@code ViewResolver} (giving it 0 as "order" value), while all |
|
|
|
* (giving it 0 as "order" value), while all remaining views could be resolved by |
|
|
|
* remaining views could be resolved by a {@link UrlBasedViewResolver}. |
|
|
|
* a {@link UrlBasedViewResolver}. |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Rod Johnson |
|
|
|
* @author Rod Johnson |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -110,7 +108,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
* @see java.util.ResourceBundle#getBundle(String) |
|
|
|
* @see java.util.ResourceBundle#getBundle(String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setBasename(String basename) { |
|
|
|
public void setBasename(String basename) { |
|
|
|
setBasenames(new String[] {basename}); |
|
|
|
setBasenames(basename); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -173,7 +171,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
* <p>Allows for pre-initialization of common Locales, eagerly checking |
|
|
|
* <p>Allows for pre-initialization of common Locales, eagerly checking |
|
|
|
* the view configuration for those Locales. |
|
|
|
* the view configuration for those Locales. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setLocalesToInitialize(Locale[] localesToInitialize) { |
|
|
|
public void setLocalesToInitialize(Locale... localesToInitialize) { |
|
|
|
this.localesToInitialize = localesToInitialize; |
|
|
|
this.localesToInitialize = localesToInitialize; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -198,7 +196,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver |
|
|
|
return factory.getBean(viewName, View.class); |
|
|
|
return factory.getBean(viewName, View.class); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (NoSuchBeanDefinitionException ex) { |
|
|
|
catch (NoSuchBeanDefinitionException ex) { |
|
|
|
// to allow for ViewResolver chaining
|
|
|
|
// Allow for ViewResolver chaining...
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|