|
spring-web | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.web.context.support.ServletContextScope
public class ServletContextScope
Scope
wrapper for a ServletContext, i.e. for global web application attributes.
This differs from traditional Spring singletons in that it exposes attributes in the ServletContext. Those attributes will get destroyed whenever the entire application shuts down, which might be earlier or later than the shutdown of the containing Spring ApplicationContext.
The associated destruction mechanism relies on a
ContextCleanupListener
being registered in
web.xml
. Note that ContextLoaderListener
includes ContextCleanupListener's functionality.
This scope is registered as default scope with key
"application"
.
ContextCleanupListener
Constructor Summary | |
---|---|
ServletContextScope(javax.servlet.ServletContext servletContext)
Create a new Scope wrapper for the given ServletContext. |
Method Summary | |
---|---|
void |
destroy()
Invoke all registered destruction callbacks. |
java.lang.Object |
get(java.lang.String name,
org.springframework.beans.factory.ObjectFactory<?> objectFactory)
|
java.lang.String |
getConversationId()
|
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
|
java.lang.Object |
remove(java.lang.String name)
|
java.lang.Object |
resolveContextualObject(java.lang.String key)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServletContextScope(javax.servlet.ServletContext servletContext)
servletContext
- the ServletContext to wrapMethod Detail |
---|
public java.lang.Object get(java.lang.String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
get
in interface org.springframework.beans.factory.config.Scope
public java.lang.Object remove(java.lang.String name)
remove
in interface org.springframework.beans.factory.config.Scope
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
registerDestructionCallback
in interface org.springframework.beans.factory.config.Scope
public java.lang.Object resolveContextualObject(java.lang.String key)
resolveContextualObject
in interface org.springframework.beans.factory.config.Scope
public java.lang.String getConversationId()
getConversationId
in interface org.springframework.beans.factory.config.Scope
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
ContextCleanupListener
|
spring-web | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |