public class

StaticPortletApplicationContext

extends StaticApplicationContext
implements ConfigurablePortletApplicationContext
java.lang.Object
   ↳ org.springframework.core.io.DefaultResourceLoader
     ↳ org.springframework.context.support.AbstractApplicationContext
       ↳ org.springframework.context.support.GenericApplicationContext
         ↳ org.springframework.context.support.StaticApplicationContext
           ↳ org.springframework.web.portlet.context.StaticPortletApplicationContext

Class Overview

Static Portlet-based ApplicationContext implementation for testing. Not intended for use in production applications.

Implements the ConfigurablePortletApplicationContext interface to allow for direct replacement of an XmlPortletApplicationContext, despite not actually supporting external configuration files.

Interprets resource paths as portlet context resources, that is, as paths beneath the portlet application root. Absolute paths, for example for files outside the portlet app root, can be accessed via "file:" URLs, as implemented by DefaultResourceLoader.

Summary

[Expand]
Inherited Constants
From class org.springframework.context.support.AbstractApplicationContext
From interface org.springframework.beans.factory.BeanFactory
From interface org.springframework.context.ConfigurableApplicationContext
From interface org.springframework.core.io.ResourceLoader
From interface org.springframework.core.io.support.ResourcePatternResolver
From interface org.springframework.web.context.WebApplicationContext
From interface org.springframework.web.portlet.context.ConfigurablePortletApplicationContext
[Expand]
Inherited Fields
From class org.springframework.context.support.AbstractApplicationContext
From interface org.springframework.web.context.WebApplicationContext
From interface org.springframework.web.portlet.context.ConfigurablePortletApplicationContext
Public Constructors
StaticPortletApplicationContext()
Public Methods
String[] getConfigLocations()
Return the config locations for this web application context, or null if none specified.
String getNamespace()
Return the namespace for this web application context, if any.
PortletConfig getPortletConfig()
Return the PortletConfig for this portlet application context, if any.
PortletContext getPortletContext()
Return the standard Portlet API PortletContext for this application.
ServletContext getServletContext()
Return the standard Servlet API ServletContext for this application.
void setConfigLocation(String configLocation)
The StaticPortletApplicationContext class does not support this method.
void setConfigLocations(String[] configLocations)
The StaticPortletApplicationContext class does not support this method.
void setNamespace(String namespace)
Set the namespace for this portlet application context, to be used for building a default context config location.
void setParent(ApplicationContext parent)
Set the parent of this application context, also setting the parent of the internal BeanFactory accordingly.
void setPortletConfig(PortletConfig portletConfig)
Set the PortletConfig for this portlet application context.
void setPortletContext(PortletContext portletContext)
Set the PortletContext for this portlet application context.
Protected Methods
ConfigurableEnvironment createEnvironment()
Resource getResourceByPath(String path)
This implementation supports file paths beneath the root of the PortletContext.
ResourcePatternResolver getResourcePatternResolver()
This implementation supports pattern matching in unexpanded WARs too.
void initPropertySources()

Replace any stub property sources with actual instances.

Replace Portlet- and Servlet-related property sources.

void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Register request/session scopes, a PortletContextAwareProcessor, etc.
[Expand]
Inherited Methods
From class org.springframework.context.support.StaticApplicationContext
From class org.springframework.context.support.GenericApplicationContext
From class org.springframework.context.support.AbstractApplicationContext
From class org.springframework.core.io.DefaultResourceLoader
From class java.lang.Object
From interface org.springframework.beans.factory.BeanFactory
From interface org.springframework.beans.factory.DisposableBean
From interface org.springframework.beans.factory.HierarchicalBeanFactory
From interface org.springframework.beans.factory.ListableBeanFactory
From interface org.springframework.beans.factory.support.BeanDefinitionRegistry
From interface org.springframework.context.ApplicationContext
From interface org.springframework.context.ApplicationEventPublisher
From interface org.springframework.context.ConfigurableApplicationContext
From interface org.springframework.context.Lifecycle
From interface org.springframework.context.MessageSource
From interface org.springframework.core.AliasRegistry
From interface org.springframework.core.env.EnvironmentCapable
From interface org.springframework.core.io.ResourceLoader
From interface org.springframework.core.io.support.ResourcePatternResolver
From interface org.springframework.web.context.WebApplicationContext
From interface org.springframework.web.portlet.context.ConfigurablePortletApplicationContext

Public Constructors

public StaticPortletApplicationContext ()

Public Methods

public String[] getConfigLocations ()

Return the config locations for this web application context, or null if none specified.

public String getNamespace ()

Return the namespace for this web application context, if any.

public PortletConfig getPortletConfig ()

Return the PortletConfig for this portlet application context, if any.

public PortletContext getPortletContext ()

Return the standard Portlet API PortletContext for this application.

public ServletContext getServletContext ()

Return the standard Servlet API ServletContext for this application.

Also available for a Portlet application, in addition to the PortletContext.

public void setConfigLocation (String configLocation)

The StaticPortletApplicationContext class does not support this method.

public void setConfigLocations (String[] configLocations)

The StaticPortletApplicationContext class does not support this method.

public void setNamespace (String namespace)

Set the namespace for this portlet application context, to be used for building a default context config location.

public void setParent (ApplicationContext parent)

Set the parent of this application context, also setting the parent of the internal BeanFactory accordingly.

Parameters
parent the parent context

public void setPortletConfig (PortletConfig portletConfig)

Set the PortletConfig for this portlet application context.

public void setPortletContext (PortletContext portletContext)

Set the PortletContext for this portlet application context.

Does not cause an initialization of the context: refresh needs to be called after the setting of all configuration properties.

Protected Methods

protected ConfigurableEnvironment createEnvironment ()

protected Resource getResourceByPath (String path)

This implementation supports file paths beneath the root of the PortletContext.

Parameters
path the path to the resource
Returns
  • the corresponding Resource handle

protected ResourcePatternResolver getResourcePatternResolver ()

This implementation supports pattern matching in unexpanded WARs too.

Returns
  • the ResourcePatternResolver for this context

protected void initPropertySources ()

Replace any stub property sources with actual instances.

Replace Portlet- and Servlet-related property sources.

protected void postProcessBeanFactory (ConfigurableListableBeanFactory beanFactory)

Register request/session scopes, a PortletContextAwareProcessor, etc.

Parameters
beanFactory the bean factory used by the application context