Example usage for org.springframework.web.context.support ServletContextAwareProcessor ServletContextAwareProcessor

List of usage examples for org.springframework.web.context.support ServletContextAwareProcessor ServletContextAwareProcessor

Introduction

In this page you can find the example usage for org.springframework.web.context.support ServletContextAwareProcessor ServletContextAwareProcessor.

Prototype

public ServletContextAwareProcessor(@Nullable ServletContext servletContext,
        @Nullable ServletConfig servletConfig) 

Source Link

Document

Create a new ServletContextAwareProcessor for the given context and config.

Usage

From source file:fi.eis.applications.osgi.support.OsgiBundleXmlWebApplicationContext.java

/**
 * {@inheritDoc}//from  www .j a  va  2 s.  co m
 * 
 * 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);
}

From source file:ro.codecamp.ebp.core.util.ServerOsgiBundleXmlWebApplicationContext.java

/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 * /*from w w w  .  ja va  2  s. c o m*/
 * @see WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory)
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.postProcessBeanFactory(beanFactory);

    // Drive the kernel's bean factory post processors.
    BundleContext bundleContext = getBundleContext();
    if (bundleContext != null) {
        ServiceReference sr = bundleContext.getServiceReference(OsgiBeanFactoryPostProcessor.class);
        if (sr != null) {
            OsgiBeanFactoryPostProcessor kernelPostProcessor = (OsgiBeanFactoryPostProcessor) bundleContext
                    .getService(sr);
            try {
                kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory);
            } catch (Exception e) {
                throw new ApplicationContextException("Kernel bean factory post processor failed", e);
            } finally {
                bundleContext.ungetService(sr);
            }
        }
    }

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig()));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
    beanFactory.registerResolvableDependency(ServletContext.class, getServletContext());
    beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig());

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}

From source file:com.productone.spring.ServerOsgiBundleXmlWebApplicationContext.java

/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor},
 * etc.//from  ww  w  .  jav  a2s . c om
 *
 * @see
 * WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory)
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.postProcessBeanFactory(beanFactory);

    // Drive the kernel's bean factory post processors.
    BundleContext bundleContext = getBundleContext();
    if (bundleContext != null) {
        ServiceReference sr = bundleContext.getServiceReference(OsgiBeanFactoryPostProcessor.class.getName());
        if (sr != null) {
            OsgiBeanFactoryPostProcessor kernelPostProcessor = (OsgiBeanFactoryPostProcessor) bundleContext
                    .getService(sr);
            try {
                kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory);
            } catch (Exception e) {
                throw new ApplicationContextException("Kernel bean factory post processor failed", e);
            } finally {
                bundleContext.ungetService(sr);
            }
        }
    }

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig()));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
    beanFactory.registerResolvableDependency(ServletContext.class, getServletContext());
    beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig());

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}

From source file:net.solarnetwork.web.gemini.ServerOsgiBundleXmlWebApplicationContext.java

/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor},
 * etc.//from   ww w  .j  a v a 2 s .co  m
 * 
 * @see WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory)
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.postProcessBeanFactory(beanFactory);

    // Drive the kernel's bean factory post processors.
    BundleContext bundleContext = getBundleContext();
    if (bundleContext != null) {
        ServiceReference<OsgiBeanFactoryPostProcessor> sr = bundleContext
                .getServiceReference(OsgiBeanFactoryPostProcessor.class);
        if (sr != null) {
            OsgiBeanFactoryPostProcessor kernelPostProcessor = bundleContext.getService(sr);
            try {
                kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory);
            } catch (Exception e) {
                throw new ApplicationContextException("Kernel bean factory post processor failed", e);
            } finally {
                bundleContext.ungetService(sr);
            }
        }
    }

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig()));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
    beanFactory.registerResolvableDependency(ServletContext.class, getServletContext());
    beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig());

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}