Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
百灵不鸣
spring-framework
提交
b45d08f1
S
spring-framework
项目概览
百灵不鸣
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b45d08f1
编写于
9月 26, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove outdated references to ContextLoaderServlet
Issue: SPR-7725
上级
65d47afc
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
76 addition
and
119 deletion
+76
-119
spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java
...ework/orm/hibernate4/support/OpenSessionInViewFilter.java
+1
-3
spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java
...ework/orm/hibernate3/support/OpenSessionInViewFilter.java
+1
-3
spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java
...k/orm/jdo/support/OpenPersistenceManagerInViewFilter.java
+2
-5
spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java
...ework/web/context/support/WebApplicationContextUtils.java
+24
-28
spring-web/src/main/java/org/springframework/web/jsf/FacesContextUtils.java
...n/java/org/springframework/web/jsf/FacesContextUtils.java
+9
-11
spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java
...pringframework/web/multipart/support/MultipartFilter.java
+3
-4
spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
...k/web/portlet/context/PortletApplicationContextUtils.java
+35
-37
src/reference/docbook/beans-context-additional.xml
src/reference/docbook/beans-context-additional.xml
+1
-28
未找到文件。
spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java
浏览文件 @
b45d08f1
...
...
@@ -63,9 +63,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
*
* <p>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 <i>after</i> this filter).
* the default bean name is "sessionFactory".
*
* @author Juergen Hoeller
* @since 3.1
...
...
spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java
浏览文件 @
b45d08f1
...
...
@@ -78,9 +78,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
*
* <p>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 <i>after</i> this filter).
* the default bean name is "sessionFactory".
*
* @author Juergen Hoeller
* @since 1.2
...
...
spring-orm/src/main/java/org/springframework/orm/jdo/support/OpenPersistenceManagerInViewFilter.java
浏览文件 @
b45d08f1
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
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.
...
...
@@ -17,7 +17,6 @@
package
org.springframework.orm.jdo.support
;
import
java.io.IOException
;
import
javax.jdo.PersistenceManager
;
import
javax.jdo.PersistenceManagerFactory
;
import
javax.servlet.FilterChain
;
...
...
@@ -46,9 +45,7 @@ import org.springframework.web.filter.OncePerRequestFilter;
*
* <p>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 <i>after</i> this filter).
* the default bean name is "persistenceManagerFactory".
*
* @author Juergen Hoeller
* @since 1.1
...
...
spring-web/src/main/java/org/springframework/web/context/support/WebApplicationContextUtils.java
浏览文件 @
b45d08f1
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
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}.
* <p>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}.
* <p>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 s
c
the ServletContext that we're running within
* @param
c
onfig the ServletConfig of the containing Portlet
* @param s
ervletContext
the ServletContext that we're running within
* @param
servletC
onfig the ServletConfig of the containing Portlet
*/
public
static
void
registerEnvironmentBeans
(
ConfigurableListableBeanFactory
bf
,
ServletContext
s
c
,
ServletConfig
c
onfig
)
{
ConfigurableListableBeanFactory
bf
,
ServletContext
s
ervletContext
,
ServletConfig
servletC
onfig
)
{
if
(
s
c
!=
null
&&
!
bf
.
containsBean
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
))
{
bf
.
registerSingleton
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
,
s
c
);
if
(
s
ervletContext
!=
null
&&
!
bf
.
containsBean
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
))
{
bf
.
registerSingleton
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
,
s
ervletContext
);
}
if
(
c
onfig
!=
null
&&
!
bf
.
containsBean
(
ConfigurableWebApplicationContext
.
SERVLET_CONFIG_BEAN_NAME
))
{
bf
.
registerSingleton
(
ConfigurableWebApplicationContext
.
SERVLET_CONFIG_BEAN_NAME
,
c
onfig
);
if
(
servletC
onfig
!=
null
&&
!
bf
.
containsBean
(
ConfigurableWebApplicationContext
.
SERVLET_CONFIG_BEAN_NAME
))
{
bf
.
registerSingleton
(
ConfigurableWebApplicationContext
.
SERVLET_CONFIG_BEAN_NAME
,
servletC
onfig
);
}
if
(!
bf
.
containsBean
(
WebApplicationContext
.
CONTEXT_PARAMETERS_BEAN_NAME
))
{
Map
<
String
,
String
>
parameterMap
=
new
HashMap
<
String
,
String
>();
if
(
s
c
!=
null
)
{
Enumeration
<?>
paramNameEnum
=
s
c
.
getInitParameterNames
();
if
(
s
ervletContext
!=
null
)
{
Enumeration
<?>
paramNameEnum
=
s
ervletContext
.
getInitParameterNames
();
while
(
paramNameEnum
.
hasMoreElements
())
{
String
paramName
=
(
String
)
paramNameEnum
.
nextElement
();
parameterMap
.
put
(
paramName
,
s
c
.
getInitParameter
(
paramName
));
parameterMap
.
put
(
paramName
,
s
ervletContext
.
getInitParameter
(
paramName
));
}
}
if
(
c
onfig
!=
null
)
{
Enumeration
<?>
paramNameEnum
=
c
onfig
.
getInitParameterNames
();
if
(
servletC
onfig
!=
null
)
{
Enumeration
<?>
paramNameEnum
=
servletC
onfig
.
getInitParameterNames
();
while
(
paramNameEnum
.
hasMoreElements
())
{
String
paramName
=
(
String
)
paramNameEnum
.
nextElement
();
parameterMap
.
put
(
paramName
,
c
onfig
.
getInitParameter
(
paramName
));
parameterMap
.
put
(
paramName
,
servletC
onfig
.
getInitParameter
(
paramName
));
}
}
bf
.
registerSingleton
(
WebApplicationContext
.
CONTEXT_PARAMETERS_BEAN_NAME
,
...
...
@@ -211,11 +209,11 @@ public abstract class WebApplicationContextUtils {
if
(!
bf
.
containsBean
(
WebApplicationContext
.
CONTEXT_ATTRIBUTES_BEAN_NAME
))
{
Map
<
String
,
Object
>
attributeMap
=
new
HashMap
<
String
,
Object
>();
if
(
s
c
!=
null
)
{
Enumeration
<?>
attrNameEnum
=
s
c
.
getAttributeNames
();
if
(
s
ervletContext
!=
null
)
{
Enumeration
<?>
attrNameEnum
=
s
ervletContext
.
getAttributeNames
();
while
(
attrNameEnum
.
hasMoreElements
())
{
String
attrName
=
(
String
)
attrNameEnum
.
nextElement
();
attributeMap
.
put
(
attrName
,
s
c
.
getAttribute
(
attrName
));
attributeMap
.
put
(
attrName
,
s
ervletContext
.
getAttribute
(
attrName
));
}
}
bf
.
registerSingleton
(
WebApplicationContext
.
CONTEXT_ATTRIBUTES_BEAN_NAME
,
...
...
@@ -229,9 +227,7 @@ public abstract class WebApplicationContextUtils {
* {@link ServletConfig} parameter.
* @see #initServletPropertySources(MutablePropertySources, ServletContext, ServletConfig)
*/
public
static
void
initServletPropertySources
(
MutablePropertySources
propertySources
,
ServletContext
servletContext
)
{
public
static
void
initServletPropertySources
(
MutablePropertySources
propertySources
,
ServletContext
servletContext
)
{
initServletPropertySources
(
propertySources
,
servletContext
,
null
);
}
...
...
spring-web/src/main/java/org/springframework/web/jsf/FacesContextUtils.java
浏览文件 @
b45d08f1
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
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.
...
...
@@ -24,9 +24,9 @@ import org.springframework.web.context.WebApplicationContext;
import
org.springframework.web.util.WebUtils
;
/**
* Convenience methods to retrieve
the root WebApplicationContext for a given
*
FacesContext. This is e.g. useful for accessing a Spring context from
*
custom JSF
code.
* Convenience methods to retrieve
Spring's root {@link WebApplicationContext}
*
for a given JSF {@link FacesContext}. This is useful for accessing a
*
Spring application context from custom JSF-based
code.
*
* <p>Analogous to Spring's WebApplicationContextUtils for the ServletContext.
*
...
...
@@ -38,8 +38,8 @@ import org.springframework.web.util.WebUtils;
public
abstract
class
FacesContextUtils
{
/**
* Find the root
WebApplicationContext for this web app, 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}
.
* <p>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
WebApplicationContext for this web app, 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}
.
* <p>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?"
);
...
...
spring-web/src/main/java/org/springframework/web/multipart/support/MultipartFilter.java
浏览文件 @
b45d08f1
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
4
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;
*
* <p>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 <i>after</i> this filter).
* the default bean name is "filterMultipartResolver".
*
* <p>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"
);
}
...
...
spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/PortletApplicationContextUtils.java
浏览文件 @
b45d08f1
/*
* Copyright 2002-201
3
the original author or authors.
* Copyright 2002-201
4
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}
.
* <p>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}
.
* <p>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 b
eanFactory
the BeanFactory to configure
* @param b
f
the BeanFactory to configure
* @param pc the PortletContext that we're running within
*/
static
void
registerPortletApplicationScopes
(
ConfigurableListableBeanFactory
b
eanFactory
,
PortletContext
pc
)
{
b
eanFactory
.
registerScope
(
WebApplicationContext
.
SCOPE_REQUEST
,
new
RequestScope
());
b
eanFactory
.
registerScope
(
WebApplicationContext
.
SCOPE_SESSION
,
new
SessionScope
(
false
));
b
eanFactory
.
registerScope
(
WebApplicationContext
.
SCOPE_GLOBAL_SESSION
,
new
SessionScope
(
true
));
static
void
registerPortletApplicationScopes
(
ConfigurableListableBeanFactory
b
f
,
PortletContext
pc
)
{
b
f
.
registerScope
(
WebApplicationContext
.
SCOPE_REQUEST
,
new
RequestScope
());
b
f
.
registerScope
(
WebApplicationContext
.
SCOPE_SESSION
,
new
SessionScope
(
false
));
b
f
.
registerScope
(
WebApplicationContext
.
SCOPE_GLOBAL_SESSION
,
new
SessionScope
(
true
));
if
(
pc
!=
null
)
{
PortletContextScope
appScope
=
new
PortletContextScope
(
pc
);
b
eanFactory
.
registerScope
(
WebApplicationContext
.
SCOPE_APPLICATION
,
appScope
);
b
f
.
registerScope
(
WebApplicationContext
.
SCOPE_APPLICATION
,
appScope
);
// Register as PortletContext attribute, for ContextCleanupListener to detect it.
pc
.
setAttribute
(
PortletContextScope
.
class
.
getName
(),
appScope
);
}
b
eanFactory
.
registerResolvableDependency
(
PortletRequest
.
class
,
new
RequestObjectFactory
());
b
eanFactory
.
registerResolvableDependency
(
PortletSession
.
class
,
new
SessionObjectFactory
());
b
eanFactory
.
registerResolvableDependency
(
WebRequest
.
class
,
new
WebRequestObjectFactory
());
b
f
.
registerResolvableDependency
(
PortletRequest
.
class
,
new
RequestObjectFactory
());
b
f
.
registerResolvableDependency
(
PortletSession
.
class
,
new
SessionObjectFactory
());
b
f
.
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 s
c
the ServletContext that we're running within
* @param p
c
the PortletContext that we're running within
* @param
c
onfig the PortletConfig of the containing Portlet
* @param s
ervletContext
the ServletContext that we're running within
* @param p
ortletContext
the PortletContext that we're running within
* @param
portletC
onfig the PortletConfig of the containing Portlet
*/
static
void
registerEnvironmentBeans
(
ConfigurableListableBeanFactory
bf
,
ServletContext
sc
,
PortletContext
pc
,
PortletConfig
c
onfig
)
{
static
void
registerEnvironmentBeans
(
ConfigurableListableBeanFactory
bf
,
ServletContext
servletContext
,
PortletContext
portletContext
,
PortletConfig
portletC
onfig
)
{
if
(
s
c
!=
null
&&
!
bf
.
containsBean
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
))
{
bf
.
registerSingleton
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
,
s
c
);
if
(
s
ervletContext
!=
null
&&
!
bf
.
containsBean
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
))
{
bf
.
registerSingleton
(
WebApplicationContext
.
SERVLET_CONTEXT_BEAN_NAME
,
s
ervletContext
);
}
if
(
p
c
!=
null
&&
!
bf
.
containsBean
(
ConfigurablePortletApplicationContext
.
PORTLET_CONTEXT_BEAN_NAME
))
{
bf
.
registerSingleton
(
ConfigurablePortletApplicationContext
.
PORTLET_CONTEXT_BEAN_NAME
,
p
c
);
if
(
p
ortletContext
!=
null
&&
!
bf
.
containsBean
(
ConfigurablePortletApplicationContext
.
PORTLET_CONTEXT_BEAN_NAME
))
{
bf
.
registerSingleton
(
ConfigurablePortletApplicationContext
.
PORTLET_CONTEXT_BEAN_NAME
,
p
ortletContext
);
}
if
(
c
onfig
!=
null
&&
!
bf
.
containsBean
(
ConfigurablePortletApplicationContext
.
PORTLET_CONFIG_BEAN_NAME
))
{
bf
.
registerSingleton
(
ConfigurablePortletApplicationContext
.
PORTLET_CONFIG_BEAN_NAME
,
c
onfig
);
if
(
portletC
onfig
!=
null
&&
!
bf
.
containsBean
(
ConfigurablePortletApplicationContext
.
PORTLET_CONFIG_BEAN_NAME
))
{
bf
.
registerSingleton
(
ConfigurablePortletApplicationContext
.
PORTLET_CONFIG_BEAN_NAME
,
portletC
onfig
);
}
if
(!
bf
.
containsBean
(
WebApplicationContext
.
CONTEXT_PARAMETERS_BEAN_NAME
))
{
Map
<
String
,
String
>
parameterMap
=
new
HashMap
<
String
,
String
>();
if
(
p
c
!=
null
)
{
Enumeration
<
String
>
paramNameEnum
=
p
c
.
getInitParameterNames
();
if
(
p
ortletContext
!=
null
)
{
Enumeration
<
String
>
paramNameEnum
=
p
ortletContext
.
getInitParameterNames
();
while
(
paramNameEnum
.
hasMoreElements
())
{
String
paramName
=
paramNameEnum
.
nextElement
();
parameterMap
.
put
(
paramName
,
p
c
.
getInitParameter
(
paramName
));
parameterMap
.
put
(
paramName
,
p
ortletContext
.
getInitParameter
(
paramName
));
}
}
if
(
c
onfig
!=
null
)
{
Enumeration
<
String
>
paramNameEnum
=
c
onfig
.
getInitParameterNames
();
if
(
portletC
onfig
!=
null
)
{
Enumeration
<
String
>
paramNameEnum
=
portletC
onfig
.
getInitParameterNames
();
while
(
paramNameEnum
.
hasMoreElements
())
{
String
paramName
=
paramNameEnum
.
nextElement
();
parameterMap
.
put
(
paramName
,
c
onfig
.
getInitParameter
(
paramName
));
parameterMap
.
put
(
paramName
,
portletC
onfig
.
getInitParameter
(
paramName
));
}
}
bf
.
registerSingleton
(
WebApplicationContext
.
CONTEXT_PARAMETERS_BEAN_NAME
,
...
...
@@ -174,11 +172,11 @@ public abstract class PortletApplicationContextUtils {
if
(!
bf
.
containsBean
(
WebApplicationContext
.
CONTEXT_ATTRIBUTES_BEAN_NAME
))
{
Map
<
String
,
Object
>
attributeMap
=
new
HashMap
<
String
,
Object
>();
if
(
p
c
!=
null
)
{
Enumeration
<
String
>
attrNameEnum
=
p
c
.
getAttributeNames
();
if
(
p
ortletContext
!=
null
)
{
Enumeration
<
String
>
attrNameEnum
=
p
ortletContext
.
getAttributeNames
();
while
(
attrNameEnum
.
hasMoreElements
())
{
String
attrName
=
attrNameEnum
.
nextElement
();
attributeMap
.
put
(
attrName
,
p
c
.
getAttribute
(
attrName
));
attributeMap
.
put
(
attrName
,
p
ortletContext
.
getAttribute
(
attrName
));
}
}
bf
.
registerSingleton
(
WebApplicationContext
.
CONTEXT_ATTRIBUTES_BEAN_NAME
,
...
...
src/reference/docbook/beans-context-additional.xml
浏览文件 @
b45d08f1
...
...
@@ -563,20 +563,6 @@ argument.required=Ebagum lad, the '{0}' argument is required, I say, required.</
programmatically by using one of the
<interfacename>
ApplicationContext
</interfacename>
implementations.
</para>
<para>
The
<classname>
ContextLoader
</classname>
mechanism comes in two
flavors: the
<classname>
ContextLoaderListener
</classname>
and the
<classname>
ContextLoaderServlet
</classname>
. They have the same
functionality but differ in that the listener version is not reliable in
Servlet 2.3 containers. In the Servlet 2.4 specification, Servlet context
listeners must execute immediately after the Servlet context for the web
application is created and is available to service the first request (and
also when the Servlet context is about to be shut down). As such a Servlet
context listener is an ideal place to initialize the Spring
<interfacename>
ApplicationContext
</interfacename>
. All things being equal,
you should probably prefer
<classname>
ContextLoaderListener
</classname>
;
for more information on compatibility, have a look at the Javadoc for the
<classname>
ContextLoaderServlet
</classname>
.
</para>
<para>
You can register an
<interfacename>
ApplicationContext
</interfacename>
using the
<classname>
ContextLoaderListener
</classname>
as follows:
</para>
...
...
@@ -587,15 +573,7 @@ argument.required=Ebagum lad, the '{0}' argument is required, I say, required.</
<
listener
>
<
listener-class
>
org.springframework.web.context.ContextLoaderListener
<
/listener-class
>
<
/listener
>
<lineannotation>
<
!-- or use the ContextLoaderServlet instead of the above listener
</lineannotation><emphasis>
<
servlet
>
<
servlet-name
>
context
<
/servlet-name
>
<
servlet-class
>
org.springframework.web.context.ContextLoaderServlet
<
/servlet-class
>
<
load-on-startup
>
1
<
/load-on-startup
>
<
/servlet
>
--
</emphasis>
>
</programlisting>
<
/listener
>
</programlisting>
<para>
The listener inspects the
<literal>
contextConfigLocation
</literal>
parameter. If the parameter does not exist, the listener uses
...
...
@@ -608,11 +586,6 @@ argument.required=Ebagum lad, the '{0}' argument is required, I say, required.</
with "Context.xml", residing in the "WEB-INF" directory, and
<literal>
/WEB-INF/**/*Context.xml
</literal>
, for all such files in any
subdirectory of "WEB-INF".
</para>
<para>
You can use
<classname>
ContextLoaderServlet
</classname>
instead of
<classname>
ContextLoaderListener
</classname>
. The Servlet uses the
<literal>
contextConfigLocation
</literal>
parameter just as the listener
does.
</para>
</section>
<section
xml:id=
"context-deploy-rar"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录