spring-webmvc-portlet

org.springframework.web.portlet.context
Class PortletContextScope

java.lang.Object
  extended by org.springframework.web.portlet.context.PortletContextScope
All Implemented Interfaces:
org.springframework.beans.factory.config.Scope, org.springframework.beans.factory.DisposableBean

public class PortletContextScope
extends java.lang.Object
implements org.springframework.beans.factory.config.Scope, org.springframework.beans.factory.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".

Since:
3.0
Author:
Juergen Hoeller
See Also:
ContextCleanupListener

Constructor Summary
PortletContextScope(javax.portlet.PortletContext portletContext)
          Create a new Scope wrapper for the given PortletContext.
 
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

PortletContextScope

public PortletContextScope(javax.portlet.PortletContext portletContext)
Create a new Scope wrapper for the given PortletContext.

Parameters:
portletContext - the PortletContext to wrap
Method Detail

get

public java.lang.Object get(java.lang.String name,
                            org.springframework.beans.factory.ObjectFactory<?> objectFactory)
Specified by:
get in interface org.springframework.beans.factory.config.Scope

remove

public java.lang.Object remove(java.lang.String name)
Specified by:
remove in interface org.springframework.beans.factory.config.Scope

registerDestructionCallback

public void registerDestructionCallback(java.lang.String name,
                                        java.lang.Runnable callback)
Specified by:
registerDestructionCallback in interface org.springframework.beans.factory.config.Scope

resolveContextualObject

public java.lang.Object resolveContextualObject(java.lang.String key)
Specified by:
resolveContextualObject in interface org.springframework.beans.factory.config.Scope

getConversationId

public java.lang.String getConversationId()
Specified by:
getConversationId in interface org.springframework.beans.factory.config.Scope

destroy

public void destroy()
Invoke all registered destruction callbacks. To be called on ServletContext shutdown.

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
See Also:
ContextCleanupListener

spring-webmvc-portlet