org.springframework.web.portlet.context
abstract public class: AbstractRefreshablePortletApplicationContext [javadoc |
source]
java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.AbstractRefreshableApplicationContext
org.springframework.context.support.AbstractRefreshableConfigApplicationContext
org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext
All Implemented Interfaces:
ConfigurablePortletApplicationContext, WebApplicationContext, BeanNameAware, InitializingBean, ConfigurableApplicationContext, DisposableBean, ResourceLoader
Direct Known Subclasses:
XmlPortletApplicationContext
org.springframework.context.support.AbstractRefreshableApplicationContext
subclass which implements the
ConfigurablePortletApplicationContext
interface for portlet environments. Provides a "configLocations" property,
to be populated through the ConfigurablePortletApplicationContext interface
on portlet application startup.
This class is as easy to subclass as AbstractRefreshableApplicationContext:
All you need to implements is the #loadBeanDefinitions method;
see the superclass javadoc for details. Note that implementations are supposed
to load bean definitions from the files specified by the locations returned
by the #getConfigLocations method.
Interprets resource paths as servlet context resources, i.e. as paths beneath
the web application root. Absolute paths, e.g. for files outside the web app root,
can be accessed via "file:" URLs, as implemented by
org.springframework.core.io.DefaultResourceLoader .
This is the portlet context to be subclassed for a different bean definition format.
Such a context implementation can be specified as "contextClass" init-param
for FrameworkPortlet, replacing the default XmlPortletApplicationContext .
It will then automatically receive the "contextConfigLocation" init-param.
Note that Portlet-based context implementations are generally supposed
to configure themselves based on the configuration received through the
ConfigurablePortletApplicationContext interface. In contrast, a standalone
application context might allow for configuration in custom startup code
(for example, org.springframework.context.support.GenericApplicationContext ).
| Method from org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext Summary: |
|---|
|
getConfigLocations, getNamespace, getPortletConfig, getPortletContext, getResourceByPath, getResourcePatternResolver, getServletContext, postProcessBeanFactory, setNamespace, setParent, setPortletConfig, setPortletContext |
| Methods from org.springframework.context.support.AbstractApplicationContext: |
|---|
|
addApplicationListener, addBeanFactoryPostProcessor, addListener, cancelRefresh, close, closeBeanFactory, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactory, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, initApplicationEventMulticaster, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, refresh, refreshBeanFactory, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setId, setParent, start, stop, toString |
| Method from org.springframework.web.portlet.context.AbstractRefreshablePortletApplicationContext Detail: |
public String[] getConfigLocations() {
return super.getConfigLocations();
}
|
public String getNamespace() {
return this.namespace;
}
|
public PortletConfig getPortletConfig() {
return this.portletConfig;
}
|
public PortletContext getPortletContext() {
return this.portletContext;
}
|
protected Resource getResourceByPath(String path) {
return new PortletContextResource(this.portletContext, path);
}
This implementation supports file paths beneath the root of the PortletContext. |
protected ResourcePatternResolver getResourcePatternResolver() {
return new PortletContextResourcePatternResolver(this);
}
This implementation supports pattern matching in unexpanded WARs too. |
public ServletContext getServletContext() {
return this.servletContext;
}
|
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
beanFactory.addBeanPostProcessor(new PortletContextAwareProcessor(this.portletContext, this.portletConfig));
beanFactory.ignoreDependencyInterface(ServletContextAware.class);
beanFactory.ignoreDependencyInterface(PortletContextAware.class);
beanFactory.ignoreDependencyInterface(PortletConfigAware.class);
beanFactory.registerResolvableDependency(ServletContext.class, this.servletContext);
beanFactory.registerResolvableDependency(PortletContext.class, this.portletContext);
beanFactory.registerResolvableDependency(PortletConfig.class, this.portletConfig);
PortletApplicationContextUtils.registerPortletApplicationScopes(beanFactory);
}
|
public void setNamespace(String namespace) {
this.namespace = namespace;
if (namespace != null) {
setDisplayName("PortletApplicationContext for namespace '" + namespace + "'");
}
}
|
public void setParent(ApplicationContext parent) {
super.setParent(parent);
if (parent instanceof WebApplicationContext) {
this.servletContext = ((WebApplicationContext) parent).getServletContext();
}
}
|
public void setPortletConfig(PortletConfig portletConfig) {
this.portletConfig = portletConfig;
if (portletConfig != null && this.portletContext == null) {
this.portletContext = portletConfig.getPortletContext();
}
}
|
public void setPortletContext(PortletContext portletContext) {
this.portletContext = portletContext;
}
|