public class PortletContextScope extends Object implements Scope, DisposableBean
Scope
wrapper for a PortletContext, i.e. for global web application attributes.
This differs from traditional Spring singletons in that it exposes attributes in the PortletContext. 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 and Description |
---|
PortletContextScope(javax.portlet.PortletContext portletContext)
Create a new Scope wrapper for the given PortletContext.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Invoke all registered destruction callbacks.
|
Object |
get(String name,
ObjectFactory<?> objectFactory) |
String |
getConversationId() |
void |
registerDestructionCallback(String name,
Runnable callback) |
Object |
remove(String name) |
Object |
resolveContextualObject(String key) |
public PortletContextScope(javax.portlet.PortletContext portletContext)
portletContext
- the PortletContext to wrappublic void destroy()
destroy
in interface DisposableBean
ContextCleanupListener
public Object get(String name, ObjectFactory<?> objectFactory)
public String getConversationId()
getConversationId
in interface Scope
public void registerDestructionCallback(String name, Runnable callback)
registerDestructionCallback
in interface Scope
public Object resolveContextualObject(String key)
resolveContextualObject
in interface Scope
Copyright © 2019 Liferay, Inc.. All rights reserved.