diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java index e266faa2997..ff77e37cae1 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java @@ -63,9 +63,7 @@ import org.springframework.web.filter.OncePerRequestFilter; * *
Looks up the SessionFactory in Spring's root web application context. * Supports a "sessionFactoryBeanName" filter init-param in {@code web.xml}; - * the default bean name is "sessionFactory". Looks up the SessionFactory on each - * request, to avoid initialization order issues (when using ContextLoaderServlet, - * the root application context will get initialized after this filter). + * the default bean name is "sessionFactory". * * @author Juergen Hoeller * @since 3.1 diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java index 56fa98a83d0..6a059c3a0c6 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java @@ -78,9 +78,7 @@ import org.springframework.web.filter.OncePerRequestFilter; * *
Looks up the SessionFactory in Spring's root web application context. * Supports a "sessionFactoryBeanName" filter init-param in {@code web.xml}; - * the default bean name is "sessionFactory". Looks up the SessionFactory on each - * request, to avoid initialization order issues (when using ContextLoaderServlet, - * the root application context will get initialized after this filter). + * the default bean name is "sessionFactory". * * @author Juergen Hoeller * @since 1.2 diff --git a/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java b/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java index 4392ce30f84..b71d0cfbf0a 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,9 +45,7 @@ import org.springframework.web.filter.OncePerRequestFilter; * *
Looks up the PersistenceManagerFactory in Spring's root web application context. * Supports a "persistenceManagerFactoryBeanName" filter init-param in {@code web.xml}; - * the default bean name is "persistenceManagerFactory". Looks up the PersistenceManagerFactory - * on each request, to avoid initialization order issues (when using ContextLoaderServlet, - * the root application context will get initialized after this filter). + * the default bean name is "persistenceManagerFactory". * * @author Juergen Hoeller * @since 1.1 diff --git a/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java b/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java index a3e7ffb5dcb..51aa8333694 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,8 +67,8 @@ public abstract class WebApplicationContextUtils { /** - * Find the root WebApplicationContext for this web application, which is - * typically loaded via {@link org.springframework.web.context.ContextLoaderListener}. + * Find the root {@link WebApplicationContext} for this web app, typically + * loaded via {@link org.springframework.web.context.ContextLoaderListener}. *
Will rethrow an exception that happened on root context startup, * to differentiate between a failed context startup and no context at all. * @param sc ServletContext to find the web application context for @@ -76,9 +76,7 @@ public abstract class WebApplicationContextUtils { * @throws IllegalStateException if the root WebApplicationContext could not be found * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE */ - public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) - throws IllegalStateException { - + public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException { WebApplicationContext wac = getWebApplicationContext(sc); if (wac == null) { throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?"); @@ -87,8 +85,8 @@ public abstract class WebApplicationContextUtils { } /** - * Find the root WebApplicationContext for this web application, which is - * typically loaded via {@link org.springframework.web.context.ContextLoaderListener}. + * Find the root {@link WebApplicationContext} for this web app, typically + * loaded via {@link org.springframework.web.context.ContextLoaderListener}. *
Will rethrow an exception that happened on root context startup,
* to differentiate between a failed context startup and no context at all.
* @param sc ServletContext to find the web application context for
@@ -100,7 +98,7 @@ public abstract class WebApplicationContextUtils {
}
/**
- * Find a custom WebApplicationContext for this web application.
+ * Find a custom {@link WebApplicationContext} for this web app.
* @param sc ServletContext to find the web application context for
* @param attrName the name of the ServletContext attribute to look for
* @return the desired WebApplicationContext for this web app, or {@code null} if none
@@ -175,34 +173,34 @@ public abstract class WebApplicationContextUtils {
* Register web-specific environment beans ("contextParameters", "contextAttributes")
* with the given BeanFactory, as used by the WebApplicationContext.
* @param bf the BeanFactory to configure
- * @param sc the ServletContext that we're running within
- * @param config the ServletConfig of the containing Portlet
+ * @param servletContext the ServletContext that we're running within
+ * @param servletConfig the ServletConfig of the containing Portlet
*/
public static void registerEnvironmentBeans(
- ConfigurableListableBeanFactory bf, ServletContext sc, ServletConfig config) {
+ ConfigurableListableBeanFactory bf, ServletContext servletContext, ServletConfig servletConfig) {
- if (sc != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) {
- bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, sc);
+ if (servletContext != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) {
+ bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, servletContext);
}
- if (config != null && !bf.containsBean(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME)) {
- bf.registerSingleton(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, config);
+ if (servletConfig != null && !bf.containsBean(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME)) {
+ bf.registerSingleton(ConfigurableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig);
}
if (!bf.containsBean(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME)) {
Map Will rethrow an exception that happened on root context startup,
* to differentiate between a failed context startup and no context at all.
* @param fc the FacesContext to find the web application context for
@@ -66,8 +66,8 @@ public abstract class FacesContextUtils {
}
/**
- * Find the root {@link WebApplicationContext} for this web app,
- * typically loaded via ContextLoaderListener.
+ * Find the root {@link WebApplicationContext} for this web app, typically
+ * loaded via {@link org.springframework.web.context.ContextLoaderListener}.
* Will rethrow an exception that happened on root context startup,
* to differentiate between a failed context startup and no context at all.
* @param fc the FacesContext to find the web application context for
@@ -75,9 +75,7 @@ public abstract class FacesContextUtils {
* @throws IllegalStateException if the root WebApplicationContext could not be found
* @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
*/
- public static WebApplicationContext getRequiredWebApplicationContext(FacesContext fc)
- throws IllegalStateException {
-
+ public static WebApplicationContext getRequiredWebApplicationContext(FacesContext fc) throws IllegalStateException {
WebApplicationContext wac = getWebApplicationContext(fc);
if (wac == null) {
throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
diff --git a/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java b/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java
index b78ad775f91..db70bfae0da 100644
--- a/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java
+++ b/spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,9 +34,7 @@ import org.springframework.web.multipart.MultipartResolver;
*
* Looks up the MultipartResolver in Spring's root web application context.
* Supports a "multipartResolverBeanName" filter init-param in {@code web.xml};
- * the default bean name is "filterMultipartResolver". Looks up the MultipartResolver
- * on each request, to avoid initialization order issues (when using ContextLoaderServlet,
- * the root application context will get initialized after this filter).
+ * the default bean name is "filterMultipartResolver".
*
* If no MultipartResolver bean is found, this filter falls back to a default
* MultipartResolver: {@link StandardServletMultipartResolver} for Servlet 3.0,
@@ -110,6 +108,7 @@ public class MultipartFilter extends OncePerRequestFilter {
processedRequest = multipartResolver.resolveMultipart(processedRequest);
}
else {
+ // A regular request...
if (logger.isDebugEnabled()) {
logger.debug("Request [" + processedRequest.getRequestURI() + "] is not a multipart request");
}
diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
index 31c5affaa10..25088054e6c 100644
--- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
+++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,8 +56,8 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
public abstract class PortletApplicationContextUtils {
/**
- * Find the root WebApplicationContext for this portlet application, which is
- * typically loaded via ContextLoaderListener or ContextLoaderServlet.
+ * Find the root {@link WebApplicationContext} for this web app, typically
+ * loaded via {@link org.springframework.web.context.ContextLoaderListener}.
* Will rethrow an exception that happened on root context startup,
* to differentiate between a failed context startup and no context at all.
* @param pc PortletContext to find the web application context for
@@ -85,8 +85,8 @@ public abstract class PortletApplicationContextUtils {
}
/**
- * Find the root WebApplicationContext for this portlet application, which is
- * typically loaded via ContextLoaderListener or ContextLoaderServlet.
+ * Find the root {@link WebApplicationContext} for this web app, typically
+ * loaded via {@link org.springframework.web.context.ContextLoaderListener}.
* Will rethrow an exception that happened on root context startup,
* to differentiate between a failed context startup and no context at all.
* @param pc PortletContext to find the web application context for
@@ -96,9 +96,7 @@ public abstract class PortletApplicationContextUtils {
* @throws IllegalStateException if the root WebApplicationContext could not be found
* @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
*/
- public static ApplicationContext getRequiredWebApplicationContext(PortletContext pc)
- throws IllegalStateException {
-
+ public static ApplicationContext getRequiredWebApplicationContext(PortletContext pc) throws IllegalStateException {
ApplicationContext wac = getWebApplicationContext(pc);
if (wac == null) {
throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
@@ -110,62 +108,62 @@ public abstract class PortletApplicationContextUtils {
/**
* Register web-specific scopes ("request", "session", "globalSession")
* with the given BeanFactory, as used by the Portlet ApplicationContext.
- * @param beanFactory the BeanFactory to configure
+ * @param bf the BeanFactory to configure
* @param pc the PortletContext that we're running within
*/
- static void registerPortletApplicationScopes(ConfigurableListableBeanFactory beanFactory, PortletContext pc) {
- beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
- beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
- beanFactory.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));
+ static void registerPortletApplicationScopes(ConfigurableListableBeanFactory bf, PortletContext pc) {
+ bf.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
+ bf.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
+ bf.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));
if (pc != null) {
PortletContextScope appScope = new PortletContextScope(pc);
- beanFactory.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope);
+ bf.registerScope(WebApplicationContext.SCOPE_APPLICATION, appScope);
// Register as PortletContext attribute, for ContextCleanupListener to detect it.
pc.setAttribute(PortletContextScope.class.getName(), appScope);
}
- beanFactory.registerResolvableDependency(PortletRequest.class, new RequestObjectFactory());
- beanFactory.registerResolvableDependency(PortletSession.class, new SessionObjectFactory());
- beanFactory.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory());
+ bf.registerResolvableDependency(PortletRequest.class, new RequestObjectFactory());
+ bf.registerResolvableDependency(PortletSession.class, new SessionObjectFactory());
+ bf.registerResolvableDependency(WebRequest.class, new WebRequestObjectFactory());
}
/**
* Register web-specific environment beans ("contextParameters", "contextAttributes")
* with the given BeanFactory, as used by the Portlet ApplicationContext.
* @param bf the BeanFactory to configure
- * @param sc the ServletContext that we're running within
- * @param pc the PortletContext that we're running within
- * @param config the PortletConfig of the containing Portlet
+ * @param servletContext the ServletContext that we're running within
+ * @param portletContext the PortletContext that we're running within
+ * @param portletConfig the PortletConfig of the containing Portlet
*/
- static void registerEnvironmentBeans(
- ConfigurableListableBeanFactory bf, ServletContext sc, PortletContext pc, PortletConfig config) {
+ static void registerEnvironmentBeans(ConfigurableListableBeanFactory bf, ServletContext servletContext,
+ PortletContext portletContext, PortletConfig portletConfig) {
- if (sc != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) {
- bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, sc);
+ if (servletContext != null && !bf.containsBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME)) {
+ bf.registerSingleton(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME, servletContext);
}
- if (pc != null && !bf.containsBean(ConfigurablePortletApplicationContext.PORTLET_CONTEXT_BEAN_NAME)) {
- bf.registerSingleton(ConfigurablePortletApplicationContext.PORTLET_CONTEXT_BEAN_NAME, pc);
+ if (portletContext != null && !bf.containsBean(ConfigurablePortletApplicationContext.PORTLET_CONTEXT_BEAN_NAME)) {
+ bf.registerSingleton(ConfigurablePortletApplicationContext.PORTLET_CONTEXT_BEAN_NAME, portletContext);
}
- if (config != null && !bf.containsBean(ConfigurablePortletApplicationContext.PORTLET_CONFIG_BEAN_NAME)) {
- bf.registerSingleton(ConfigurablePortletApplicationContext.PORTLET_CONFIG_BEAN_NAME, config);
+ if (portletConfig != null && !bf.containsBean(ConfigurablePortletApplicationContext.PORTLET_CONFIG_BEAN_NAME)) {
+ bf.registerSingleton(ConfigurablePortletApplicationContext.PORTLET_CONFIG_BEAN_NAME, portletConfig);
}
if (!bf.containsBean(WebApplicationContext.CONTEXT_PARAMETERS_BEAN_NAME)) {
Map