當前位置: 首頁>>代碼示例>>Java>>正文


Java ServletContextAware類代碼示例

本文整理匯總了Java中org.springframework.web.context.ServletContextAware的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextAware類的具體用法?Java ServletContextAware怎麽用?Java ServletContextAware使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ServletContextAware類屬於org.springframework.web.context包,在下文中一共展示了ServletContextAware類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: postProcessBeanFactory

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
	beanFactory.ignoreDependencyInterface(ServletContextAware.class);
	beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
	WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:AbstractRefreshableWebApplicationContext.java

示例2: postProcessBeforeInitialization

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
	if (getServletContext() != null && bean instanceof ServletContextAware) {
		((ServletContextAware) bean).setServletContext(getServletContext());
	}
	if (getServletConfig() != null && bean instanceof ServletConfigAware) {
		((ServletConfigAware) bean).setServletConfig(getServletConfig());
	}
	return bean;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:ServletContextAwareProcessor.java

示例3: postProcessBeanFactory

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
/**
 * Register ServletContextAwareProcessor.
 * @see ServletContextAwareProcessor
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
	beanFactory.ignoreDependencyInterface(ServletContextAware.class);

	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
	WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:GenericWebApplicationContext.java

示例4: postProcessBeanFactory

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
/**
 * Register request/session scopes, a {@link PortletContextAwareProcessor}, etc.
 */
@Override
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);

	PortletApplicationContextUtils.registerPortletApplicationScopes(beanFactory, this.portletContext);
	PortletApplicationContextUtils.registerEnvironmentBeans(
			beanFactory, this.servletContext, this.portletContext, this.portletConfig);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:16,代碼來源:AbstractRefreshablePortletApplicationContext.java

示例5: setServletContext

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Override
public void setServletContext(ServletContext servletContext) {
	for (ViewResolver viewResolver : this.viewResolvers) {
		if (viewResolver instanceof ServletContextAware) {
			((ServletContextAware)viewResolver).setServletContext(servletContext);
		}
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:9,代碼來源:ViewResolverComposite.java

示例6: setServletContext

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Override
public void setServletContext(ServletContext servletContext) {
	RequestUpgradeStrategy strategy = getRequestUpgradeStrategy();
	if (strategy instanceof ServletContextAware) {
		((ServletContextAware) strategy).setServletContext(servletContext);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:8,代碼來源:DefaultHandshakeHandler.java

示例7: initServletContext

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Override
protected void initServletContext(ServletContext servletContext) {
	for (Object handler : getUrlMap().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:9,代碼來源:WebSocketHandlerMapping.java

示例8: setServletContext

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Override
public void setServletContext(ServletContext servletContext) {
	for (TransportHandler handler : getTransportHandlers().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:9,代碼來源:DefaultSockJsService.java

示例9: postProcessBeanFactory

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
/**
 * Register ServletContextAwareProcessor.
 * @see ServletContextAwareProcessor
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	beanFactory.addBeanPostProcessor(
			new WebApplicationContextServletContextAwareProcessor(this));
	beanFactory.ignoreDependencyInterface(ServletContextAware.class);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:11,代碼來源:EmbeddedWebApplicationContext.java

示例10: servletContextAwareBeansAreInjected

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Test
public void servletContextAwareBeansAreInjected() throws Exception {
	addEmbeddedServletContainerFactoryBean();
	ServletContextAware bean = mock(ServletContextAware.class);
	this.context.registerBeanDefinition("bean", beanDefinition(bean));
	this.context.refresh();
	verify(bean).setServletContext(
			getEmbeddedServletContainerFactory().getServletContext());
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:EmbeddedWebApplicationContextTests.java

示例11: postProcessBeforeInitialization

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
	if (this.servletContext != null && bean instanceof ServletContextAware) {
		((ServletContextAware) bean).setServletContext(this.servletContext);
	}
	if (this.servletConfig != null && bean instanceof ServletConfigAware) {
		((ServletConfigAware) bean).setServletConfig(this.servletConfig);
	}
	return bean;
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:10,代碼來源:ServletContextAwareProcessor.java

示例12: postProcessBeanFactory

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
/**
 * {@inheritDoc}
 * 
 * Registers request/session scopes, a {@link ServletContextAwareProcessor},
 * etc.
 */
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	super.postProcessBeanFactory(beanFactory);

	beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
	beanFactory.ignoreDependencyInterface(ServletContextAware.class);
	beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
	beanFactory.registerResolvableDependency(ServletContext.class, this.servletContext);
	beanFactory.registerResolvableDependency(ServletConfig.class, this.servletConfig);

	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:18,代碼來源:OsgiBundleXmlWebApplicationContext.java

示例13: testPostProcessBeanFactoryConfigurableListableBeanFactory

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
public void testPostProcessBeanFactoryConfigurableListableBeanFactory() {

		ConfigurableListableBeanFactory mock = new DefaultListableBeanFactory() {

			public void ignoreDependencyInterface(Class ifc) {
				ignored.add(ifc);
			}

			public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
				super.addBeanPostProcessor(beanPostProcessor);
				bpp.add(beanPostProcessor.getClass());
			}

			public void registerResolvableDependency(Class dependencyType, Object autowiredValue) {
				super.registerResolvableDependency(dependencyType, autowiredValue);
				resolved.add(dependencyType);
			}
		};

		context.postProcessBeanFactory(mock);

		assertTrue(ignored.contains(ServletConfigAware.class));
		assertTrue(ignored.contains(ServletContextAware.class));
		assertTrue(resolved.contains(ServletContext.class));
		assertTrue(resolved.contains(ServletConfig.class));
		assertTrue(bpp.contains(ServletContextAwareProcessor.class));
	}
 
開發者ID:BeamFoundry,項目名稱:spring-osgi,代碼行數:28,代碼來源:OsgiBundleXmlWebApplicationContextTest.java

示例14: setServletContext

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
@Override
public void setServletContext(ServletContext servletContext) {
	if (this.handshakeHandler instanceof ServletContextAware) {
		((ServletContextAware) this.handshakeHandler).setServletContext(servletContext);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:7,代碼來源:WebSocketHttpRequestHandler.java

示例15: registerInstanceInterfaces0

import org.springframework.web.context.ServletContextAware; //導入依賴的package包/類
/**
 * Registers the {@code Lifecycle}, {@code Phased} and
 * {@code ServletContextAware} aspects of the specified instance.
 *
 * @param instance  the object to examine, not null
 */
private void registerInstanceInterfaces0(Object instance) {
  if (instance instanceof Lifecycle) {
    registerLifecycle0((Lifecycle) instance);
  } else {
    findAndRegisterLifeCycle(instance);
  }
  if (instance instanceof ServletContextAware) {
    registerServletContextAware0((ServletContextAware) instance);
  }
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:17,代碼來源:ComponentRepository.java


注:本文中的org.springframework.web.context.ServletContextAware類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。