Skip to content

Commit 92bd240

Browse files
committed
Polishing
Issue: SPR-12079
1 parent 626a5fe commit 92bd240

File tree

3 files changed

+39
-36
lines changed

3 files changed

+39
-36
lines changed

spring-web/src/main/java/org/springframework/web/context/support/WebApplicationObjectSupport.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,16 +26,19 @@
2626
import org.springframework.web.util.WebUtils;
2727

2828
/**
29-
* Convenient superclass for application objects running in a WebApplicationContext.
30-
* Provides {@code getWebApplicationContext()}, {@code getServletContext()},
31-
* and {@code getTempDir()} methods.
29+
* Convenient superclass for application objects running in a {@link WebApplicationContext}.
30+
* Provides {@code getWebApplicationContext()}, {@code getServletContext()}, and
31+
* {@code getTempDir()} accessors.
32+
*
33+
* <p>Note: It is generally recommended to use individual callback interfaces for the actual
34+
* callbacks needed. This broad base class is primarily intended for use within the framework,
35+
* in case of {@link ServletContext} access etc typically being needed.
3236
*
3337
* @author Juergen Hoeller
3438
* @since 28.08.2003
3539
* @see SpringBeanAutowiringSupport
3640
*/
37-
public abstract class WebApplicationObjectSupport extends ApplicationObjectSupport
38-
implements ServletContextAware {
41+
public abstract class WebApplicationObjectSupport extends ApplicationObjectSupport implements ServletContextAware {
3942

4043
private ServletContext servletContext;
4144

spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,22 @@
3636
import org.springframework.web.servlet.View;
3737

3838
/**
39-
* {@link org.springframework.web.servlet.ViewResolver} implementation
40-
* that uses bean definitions in a {@link ResourceBundle}, specified by
41-
* the bundle basename.
39+
* A {@link org.springframework.web.servlet.ViewResolver} implementation that uses
40+
* bean definitions in a {@link ResourceBundle}, specified by the bundle basename.
4241
*
43-
* <p>The bundle is typically defined in a properties file, located in
44-
* the class path. The default bundle basename is "views".
42+
* <p>The bundle is typically defined in a properties file, located in the classpath.
43+
* The default bundle basename is "views".
4544
*
46-
* <p>This {@code ViewResolver} supports localized view definitions,
47-
* using the default support of {@link java.util.PropertyResourceBundle}.
48-
* For example, the basename "views" will be resolved as class path resources
49-
* "views_de_AT.properties", "views_de.properties", "views.properties" -
50-
* for a given Locale "de_AT".
45+
* <p>This {@code ViewResolver} supports localized view definitions, using the
46+
* default support of {@link java.util.PropertyResourceBundle}. For example, the
47+
* basename "views" will be resolved as class path resources "views_de_AT.properties",
48+
* "views_de.properties", "views.properties" - for a given Locale "de_AT".
5149
*
52-
* <p>Note: this {@code ViewResolver} implements the {@link Ordered}
53-
* interface to allow for flexible participation in {@code ViewResolver}
54-
* chaining. For example, some special views could be defined via this
55-
* {@code ViewResolver} (giving it 0 as "order" value), while all
56-
* remaining views could be resolved by a {@link UrlBasedViewResolver}.
50+
* <p>Note: This {@code ViewResolver} implements the {@link Ordered} interface
51+
* in order to allow for flexible participation in {@code ViewResolver} chaining.
52+
* For example, some special views could be defined via this {@code ViewResolver}
53+
* (giving it 0 as "order" value), while all remaining views could be resolved by
54+
* a {@link UrlBasedViewResolver}.
5755
*
5856
* @author Rod Johnson
5957
* @author Juergen Hoeller
@@ -110,7 +108,7 @@ public int getOrder() {
110108
* @see java.util.ResourceBundle#getBundle(String)
111109
*/
112110
public void setBasename(String basename) {
113-
setBasenames(new String[] {basename});
111+
setBasenames(basename);
114112
}
115113

116114
/**
@@ -173,7 +171,7 @@ public void setDefaultParentView(String defaultParentView) {
173171
* <p>Allows for pre-initialization of common Locales, eagerly checking
174172
* the view configuration for those Locales.
175173
*/
176-
public void setLocalesToInitialize(Locale[] localesToInitialize) {
174+
public void setLocalesToInitialize(Locale... localesToInitialize) {
177175
this.localesToInitialize = localesToInitialize;
178176
}
179177

@@ -198,7 +196,7 @@ protected View loadView(String viewName, Locale locale) throws Exception {
198196
return factory.getBean(viewName, View.class);
199197
}
200198
catch (NoSuchBeanDefinitionException ex) {
201-
// to allow for ViewResolver chaining
199+
// Allow for ViewResolver chaining...
202200
return null;
203201
}
204202
}

spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@
3232
import org.springframework.web.servlet.View;
3333

3434
/**
35-
* Implementation of ViewResolver that uses bean definitions in an
36-
* XML file, specified by resource location. The file will typically
37-
* be located in the WEB-INF directory; default is "/WEB-INF/views.xml".
35+
* A {@link org.springframework.web.servlet.ViewResolver} implementation that uses
36+
* bean definitions in a dedicated XML file for view definitions, specified by
37+
* resource location. The file will typically be located in the WEB-INF directory;
38+
* the default is "/WEB-INF/views.xml".
3839
*
39-
* <p>This ViewResolver does not support internationalization.
40-
* Consider ResourceBundleViewResolver if you need to apply
41-
* different view resources per locale.
40+
* <p>This {@code ViewResolver} does not support internationalization at the level
41+
* of its definition resources. Consider {@link ResourceBundleViewResolver} if you
42+
* need to apply different view resources per locale.
4243
*
43-
* <p>Note: This ViewResolver implements the Ordered interface to allow for
44-
* flexible participation in ViewResolver chaining. For example, some special
45-
* views could be defined via this ViewResolver (giving it 0 as "order" value),
46-
* while all remaining views could be resolved by a UrlBasedViewResolver.
44+
* <p>Note: This {@code ViewResolver} implements the {@link Ordered} interface
45+
* in order to allow for flexible participation in {@code ViewResolver} chaining.
46+
* For example, some special views could be defined via this {@code ViewResolver}
47+
* (giving it 0 as "order" value), while all remaining views could be resolved by
48+
* a {@link UrlBasedViewResolver}.
4749
*
4850
* @author Juergen Hoeller
4951
* @since 18.06.2003
@@ -71,7 +73,7 @@ public void setOrder(int order) {
7173

7274
@Override
7375
public int getOrder() {
74-
return order;
76+
return this.order;
7577
}
7678

7779
/**
@@ -111,7 +113,7 @@ protected View loadView(String viewName, Locale locale) throws BeansException {
111113
return factory.getBean(viewName, View.class);
112114
}
113115
catch (NoSuchBeanDefinitionException ex) {
114-
// to allow for ViewResolver chaining
116+
// Allow for ViewResolver chaining...
115117
return null;
116118
}
117119
}

0 commit comments

Comments
 (0)