当前位置: 首页>>代码示例>>Java>>正文


Java PortletApplicationContextUtils类代码示例

本文整理汇总了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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:28,代码来源:FrameworkPortlet.java

示例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);
            }
        }
    });
}
 
开发者ID:peholmst,项目名称:vaadin4spring,代码行数:19,代码来源:SpringAwareVaadinPortlet.java


注:本文中的org.springframework.web.portlet.context.PortletApplicationContextUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。