org.springframework.web.context.ServletContextAware Java Examples

The following examples show how to use org.springframework.web.context.ServletContextAware. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewResolverComposite.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	for (ViewResolver viewResolver : this.viewResolvers) {
		if (viewResolver instanceof ServletContextAware) {
			((ServletContextAware)viewResolver).setServletContext(servletContext);
		}
	}
}
 
Example #2
Source File: StaticWebApplicationContext.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: ViewResolverComposite.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	for (ViewResolver viewResolver : this.viewResolvers) {
		if (viewResolver instanceof ServletContextAware) {
			((ServletContextAware)viewResolver).setServletContext(servletContext);
		}
	}
}
 
Example #4
Source File: AbstractRefreshableWebApplicationContext.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: ViewResolverComposite.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	for (ViewResolver viewResolver : this.viewResolvers) {
		if (viewResolver instanceof ServletContextAware) {
			((ServletContextAware)viewResolver).setServletContext(servletContext);
		}
	}
}
 
Example #6
Source File: ServletContextAwareProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #7
Source File: StaticWebApplicationContext.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #8
Source File: GenericWebApplicationContext.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #9
Source File: AbstractRefreshableWebApplicationContext.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #10
Source File: AbstractRefreshablePortletApplicationContext.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #11
Source File: GenericWebApplicationContext.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Register ServletContextAwareProcessor.
 * @see ServletContextAwareProcessor
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	if (this.servletContext != null) {
		beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
		beanFactory.ignoreDependencyInterface(ServletContextAware.class);
	}
	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
	WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext);
}
 
Example #12
Source File: DefaultHandshakeHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	RequestUpgradeStrategy strategy = getRequestUpgradeStrategy();
	if (strategy instanceof ServletContextAware) {
		((ServletContextAware) strategy).setServletContext(servletContext);
	}
}
 
Example #13
Source File: WebSocketHandlerMapping.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected void initServletContext(ServletContext servletContext) {
	for (Object handler : getUrlMap().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}
 
Example #14
Source File: DefaultSockJsService.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	for (TransportHandler handler : getTransportHandlers().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}
 
Example #15
Source File: ServletContextAwareProcessor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #16
Source File: StaticWebApplicationContext.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #17
Source File: GenericWebApplicationContext.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #18
Source File: AbstractRefreshableWebApplicationContext.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: CubaClassPathXmlApplicationContext.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    if (this.servletContext != null) {
        beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
        beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    }
}
 
Example #20
Source File: StaticWebApplicationContext.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #21
Source File: DefaultHandshakeHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	RequestUpgradeStrategy strategy = getRequestUpgradeStrategy();
	if (strategy instanceof ServletContextAware) {
		((ServletContextAware) strategy).setServletContext(servletContext);
	}
}
 
Example #22
Source File: WebSocketHandlerMapping.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected void initServletContext(ServletContext servletContext) {
	for (Object handler : getUrlMap().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}
 
Example #23
Source File: DefaultSockJsService.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	for (TransportHandler handler : getTransportHandlers().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}
 
Example #24
Source File: ServletContextAwareProcessor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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;
}
 
Example #25
Source File: ServletContextAwareProcessor.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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;
}
 
Example #26
Source File: GenericWebApplicationContext.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Register ServletContextAwareProcessor.
 * @see ServletContextAwareProcessor
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
	if (this.servletContext != null) {
		beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext));
		beanFactory.ignoreDependencyInterface(ServletContextAware.class);
	}
	WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
	WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext);
}
 
Example #27
Source File: AbstractRefreshableWebApplicationContext.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #28
Source File: ViewResolverComposite.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	for (ViewResolver viewResolver : this.viewResolvers) {
		if (viewResolver instanceof ServletContextAware) {
			((ServletContextAware)viewResolver).setServletContext(servletContext);
		}
	}
}
 
Example #29
Source File: DefaultHandshakeHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void setServletContext(ServletContext servletContext) {
	RequestUpgradeStrategy strategy = getRequestUpgradeStrategy();
	if (strategy instanceof ServletContextAware) {
		((ServletContextAware) strategy).setServletContext(servletContext);
	}
}
 
Example #30
Source File: WebSocketHandlerMapping.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected void initServletContext(ServletContext servletContext) {
	for (Object handler : getUrlMap().values()) {
		if (handler instanceof ServletContextAware) {
			((ServletContextAware) handler).setServletContext(servletContext);
		}
	}
}