本文整理汇总了Java中org.springframework.web.portlet.context.PortletApplicationContextUtils类的典型用法代码示例。如果您正苦于以下问题:Java PortletApplicationContextUtils类的具体用法?Java PortletApplicationContextUtils怎么用?Java PortletApplicationContextUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortletApplicationContextUtils类属于org.springframework.web.portlet.context包,在下文中一共展示了PortletApplicationContextUtils类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPortletApplicationContext
import org.springframework.web.portlet.context.PortletApplicationContextUtils; //导入依赖的package包/类
/**
* Initialize and publish the Portlet ApplicationContext for this portlet.
* <p>Delegates to {@link #createPortletApplicationContext} for actual creation.
* Can be overridden in subclasses.
* @return the ApplicationContext for this portlet
*/
protected ApplicationContext initPortletApplicationContext() {
ApplicationContext parent = PortletApplicationContextUtils.getWebApplicationContext(getPortletContext());
ApplicationContext pac = createPortletApplicationContext(parent);
if (!this.refreshEventReceived) {
// Apparently not a ConfigurableApplicationContext with refresh support:
// triggering initial onRefresh manually here.
onRefresh(pac);
}
if (this.publishContext) {
// publish the context as a portlet context attribute
String attName = getPortletContextAttributeName();
getPortletContext().setAttribute(attName, pac);
if (logger.isDebugEnabled()) {
logger.debug("Published ApplicationContext of portlet '" + getPortletName() +
"' as PortletContext attribute with name [" + attName + "]");
}
}
return pac;
}
示例2: portletInitialized
import org.springframework.web.portlet.context.PortletApplicationContextUtils; //导入依赖的package包/类
@Override
protected void portletInitialized() throws PortletException {
getService().addSessionInitListener(new SessionInitListener() {
private static final long serialVersionUID = -4571879262155039969L;
@Override
public void sessionInit(SessionInitEvent event) throws ServiceException {
try {
ApplicationContext context = PortletApplicationContextUtils
.getRequiredWebApplicationContext(getPortletContext());
SpringAwareUIProvider uiProvider = new SpringAwareUIProvider(context);
event.getSession().addUIProvider(uiProvider);
} catch (IllegalStateException e) {
throw new ServiceException(e);
}
}
});
}