Skip to content

Commit b45d08f

Browse files
committed
Remove outdated references to ContextLoaderServlet
Issue: SPR-7725
1 parent 65d47af commit b45d08f

File tree

8 files changed

+76
-119
lines changed

8 files changed

+76
-119
lines changed

spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@
6363
*
6464
* <p>Looks up the SessionFactory in Spring's root web application context.
6565
* Supports a "sessionFactoryBeanName" filter init-param in {@code web.xml};
66-
* the default bean name is "sessionFactory". Looks up the SessionFactory on each
67-
* request, to avoid initialization order issues (when using ContextLoaderServlet,
68-
* the root application context will get initialized <i>after</i> this filter).
66+
* the default bean name is "sessionFactory".
6967
*
7068
* @author Juergen Hoeller
7169
* @since 3.1

spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@
7878
*
7979
* <p>Looks up the SessionFactory in Spring's root web application context.
8080
* Supports a "sessionFactoryBeanName" filter init-param in {@code web.xml};
81-
* the default bean name is "sessionFactory". Looks up the SessionFactory on each
82-
* request, to avoid initialization order issues (when using ContextLoaderServlet,
83-
* the root application context will get initialized <i>after</i> this filter).
81+
* the default bean name is "sessionFactory".
8482
*
8583
* @author Juergen Hoeller
8684
* @since 1.2

spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java

Lines changed: 2 additions & 5 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.
@@ -17,7 +17,6 @@
1717
package org.springframework.orm.jdo.support;
1818

1919
import java.io.IOException;
20-
2120
import javax.jdo.PersistenceManager;
2221
import javax.jdo.PersistenceManagerFactory;
2322
import javax.servlet.FilterChain;
@@ -46,9 +45,7 @@
4645
*
4746
* <p>Looks up the PersistenceManagerFactory in Spring's root web application context.
4847
* Supports a "persistenceManagerFactoryBeanName" filter init-param in {@code web.xml};
49-
* the default bean name is "persistenceManagerFactory". Looks up the PersistenceManagerFactory
50-
* on each request, to avoid initialization order issues (when using ContextLoaderServlet,
51-
* the root application context will get initialized <i>after</i> this filter).
48+
* the default bean name is "persistenceManagerFactory".
5249
*
5350
* @author Juergen Hoeller
5451
* @since 1.1

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

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 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.
@@ -67,18 +67,16 @@ public abstract class WebApplicationContextUtils {
6767

6868

6969
/**
70-
* Find the root WebApplicationContext for this web application, which is
71-
* typically loaded via {@link org.springframework.web.context.ContextLoaderListener}.
70+
* Find the root {@link WebApplicationContext} for this web app, typically
71+
* loaded via {@link org.springframework.web.context.ContextLoaderListener}.
7272
* <p>Will rethrow an exception that happened on root context startup,
7373
* to differentiate between a failed context startup and no context at all.
7474
* @param sc ServletContext to find the web application context for
7575
* @return the root WebApplicationContext for this web app
7676
* @throws IllegalStateException if the root WebApplicationContext could not be found
7777
* @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
7878
*/
79-
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc)
80-
throws IllegalStateException {
81-
79+
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException {
8280
WebApplicationContext wac = getWebApplicationContext(sc);
8381
if (wac == null) {
8482
throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
@@ -87,8 +85,8 @@ public static WebApplicationContext getRequiredWebApplicationContext(ServletCont
8785
}
8886

8987
/**
90-
* Find the root WebApplicationContext for this web application, which is
91-
* typically loaded via {@link org.springframework.web.context.ContextLoaderListener}.
88+
* Find the root {@link WebApplicationContext} for this web app, typically
89+
* loaded via {@link org.springframework.web.context.ContextLoaderListener}.
9290
* <p>Will rethrow an exception that happened on root context startup,
9391
* to differentiate between a failed context startup and no context at all.
9492
* @param sc ServletContext to find the web application context for
@@ -100,7 +98,7 @@ public static WebApplicationContext getWebApplicationContext(ServletContext sc)
10098
}
10199

102100
/**
103-
* Find a custom WebApplicationContext for this web application.
101+
* Find a custom {@link WebApplicationContext} for this web app.
104102
* @param sc ServletContext to find the web application context for
105103
* @param attrName the name of the ServletContext attribute to look for
106104
* @return the desired WebApplicationContext for this web app, or {@code null} if none
@@ -175,34 +173,34 @@ public static void registerEnvironmentBeans(ConfigurableListableBeanFactory bf,
175173
* Register web-specific environment beans ("contextParameters", "contextAttributes")
176174
* with the given BeanFactory, as used by the WebApplicationContext.
177175
* @param bf the BeanFactory to configure
178-
* @param sc the ServletContext that we're running within
179-
* @param config the ServletConfig of the containing Portlet
176+
* @param servletContext the ServletContext that we're running within
177+
* @param servletConfig the ServletConfig of the containing Portlet
180178
*/
181179
public static void registerEnvironmentBeans(
182-
ConfigurableListableBeanFactory bf, ServletContext sc, ServletConfig config) {
180+
ConfigurableListableBeanFactory bf, ServletContext servletContext, ServletConfig servletConfig) {
183181

184-
if (sc != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) {
185-
bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, sc);
182+
if (servletContext != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) {
183+
bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, servletContext);
186184
}
187185

188-
if (config != null && !bf.containsBean(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME)) {
189-
bf.registerSingleton(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, config);
186+
if (servletConfig != null && !bf.containsBean(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME)) {
187+
bf.registerSingleton(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig);
190188
}
191189

192190
if (!bf.containsBean(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME)) {
193191
Map<String, String> parameterMap = new HashMap<String, String>();
194-
if (sc != null) {
195-
Enumeration<?> paramNameEnum = sc.getInitParameterNames();
192+
if (servletContext != null) {
193+
Enumeration<?> paramNameEnum = servletContext.getInitParameterNames();
196194
while (paramNameEnum.hasMoreElements()) {
197195
String paramName = (String) paramNameEnum.nextElement();
198-
parameterMap.put(paramName, sc.getInitParameter(paramName));
196+
parameterMap.put(paramName, servletContext.getInitParameter(paramName));
199197
}
200198
}
201-
if (config != null) {
202-
Enumeration<?> paramNameEnum = config.getInitParameterNames();
199+
if (servletConfig != null) {
200+
Enumeration<?> paramNameEnum = servletConfig.getInitParameterNames();
203201
while (paramNameEnum.hasMoreElements()) {
204202
String paramName = (String) paramNameEnum.nextElement();
205-
parameterMap.put(paramName, config.getInitParameter(paramName));
203+
parameterMap.put(paramName, servletConfig.getInitParameter(paramName));
206204
}
207205
}
208206
bf.registerSingleton(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME,
@@ -211,11 +209,11 @@ public static void registerEnvironmentBeans(
211209

212210
if (!bf.containsBean(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME)) {
213211
Map<String, Object> attributeMap = new HashMap<String, Object>();
214-
if (sc != null) {
215-
Enumeration<?> attrNameEnum = sc.getAttributeNames();
212+
if (servletContext != null) {
213+
Enumeration<?> attrNameEnum = servletContext.getAttributeNames();
216214
while (attrNameEnum.hasMoreElements()) {
217215
String attrName = (String) attrNameEnum.nextElement();
218-
attributeMap.put(attrName, sc.getAttribute(attrName));
216+
attributeMap.put(attrName, servletContext.getAttribute(attrName));
219217
}
220218
}
221219
bf.registerSingleton(WebApplicationContext.CONTEXT_ATTRIBUTES_BEAN_NAME,
@@ -229,9 +227,7 @@ public static void registerEnvironmentBeans(
229227
* {@link ServletConfig} parameter.
230228
* @see #initServletPropertySources(MutablePropertySources, ServletContext, ServletConfig)
231229
*/
232-
public static void initServletPropertySources(
233-
MutablePropertySources propertySources, ServletContext servletContext) {
234-
230+
public static void initServletPropertySources(MutablePropertySources propertySources, ServletContext servletContext) {
235231
initServletPropertySources(propertySources, servletContext, null);
236232
}
237233

spring-web/src/main/java/org/springframework/web/jsf/FacesContextUtils.java

Lines changed: 9 additions & 11 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.
@@ -24,9 +24,9 @@
2424
import org.springframework.web.util.WebUtils;
2525

2626
/**
27-
* Convenience methods to retrieve the root WebApplicationContext for a given
28-
* FacesContext. This is e.g. useful for accessing a Spring context from
29-
* custom JSF code.
27+
* Convenience methods to retrieve Spring's root {@link WebApplicationContext}
28+
* for a given JSF {@link FacesContext}. This is useful for accessing a
29+
* Spring application context from custom JSF-based code.
3030
*
3131
* <p>Analogous to Spring's WebApplicationContextUtils for the ServletContext.
3232
*
@@ -38,8 +38,8 @@
3838
public abstract class FacesContextUtils {
3939

4040
/**
41-
* Find the root WebApplicationContext for this web app, which is
42-
* typically loaded via ContextLoaderListener or ContextLoaderServlet.
41+
* Find the root {@link WebApplicationContext} for this web app, typically
42+
* loaded via {@link org.springframework.web.context.ContextLoaderListener}.
4343
* <p>Will rethrow an exception that happened on root context startup,
4444
* to differentiate between a failed context startup and no context at all.
4545
* @param fc the FacesContext to find the web application context for
@@ -66,18 +66,16 @@ public static WebApplicationContext getWebApplicationContext(FacesContext fc) {
6666
}
6767

6868
/**
69-
* Find the root WebApplicationContext for this web app, which is
70-
* typically loaded via ContextLoaderListener or ContextLoaderServlet.
69+
* Find the root {@link WebApplicationContext} for this web app, typically
70+
* loaded via {@link org.springframework.web.context.ContextLoaderListener}.
7171
* <p>Will rethrow an exception that happened on root context startup,
7272
* to differentiate between a failed context startup and no context at all.
7373
* @param fc the FacesContext to find the web application context for
7474
* @return the root WebApplicationContext for this web app
7575
* @throws IllegalStateException if the root WebApplicationContext could not be found
7676
* @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
7777
*/
78-
public static WebApplicationContext getRequiredWebApplicationContext(FacesContext fc)
79-
throws IllegalStateException {
80-
78+
public static WebApplicationContext getRequiredWebApplicationContext(FacesContext fc) throws IllegalStateException {
8179
WebApplicationContext wac = getWebApplicationContext(fc);
8280
if (wac == null) {
8381
throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");

spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java

Lines changed: 3 additions & 4 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.
@@ -34,9 +34,7 @@
3434
*
3535
* <p>Looks up the MultipartResolver in Spring's root web application context.
3636
* Supports a "multipartResolverBeanName" filter init-param in {@code web.xml};
37-
* the default bean name is "filterMultipartResolver". Looks up the MultipartResolver
38-
* on each request, to avoid initialization order issues (when using ContextLoaderServlet,
39-
* the root application context will get initialized <i>after</i> this filter).
37+
* the default bean name is "filterMultipartResolver".
4038
*
4139
* <p>If no MultipartResolver bean is found, this filter falls back to a default
4240
* MultipartResolver: {@link StandardServletMultipartResolver} for Servlet 3.0,
@@ -110,6 +108,7 @@ protected void doFilterInternal(
110108
processedRequest = multipartResolver.resolveMultipart(processedRequest);
111109
}
112110
else {
111+
// A regular request...
113112
if (logger.isDebugEnabled()) {
114113
logger.debug("Request [" + processedRequest.getRequestURI() + "] is not a multipart request");
115114
}

0 commit comments

Comments
 (0)