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

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

Introduction

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

Prototype

StandardServletEnvironment

Source Link

Usage

From source file:com.consol.citrus.admin.executor.ClasspathTestExecutor.java

/**
 * Finds all test cases in classpath starting in given base package. Searches for 
 * **.class files extending AbstractTestNGCitrusTest superclass.
 * /*from  w w w . j  ava 2  s  .c  o m*/
 * @param basePackage
 * @return
 */
private List<String> findTestsInClasspath(String basePackage) {
    List<String> testCaseNames = new ArrayList<String>();

    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false,
            new StandardServletEnvironment());

    scanner.addIncludeFilter(new CitrusTestTypeFilter());

    Set<BeanDefinition> findings = scanner.findCandidateComponents(basePackage);

    for (BeanDefinition bean : findings) {
        testCaseNames.add(bean.getBeanClassName());
    }

    return testCaseNames;
}

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

/**
 * {@inheritDoc}
 */
@Override
protected ConfigurableEnvironment createEnvironment() {
    return new StandardServletEnvironment();
}

From source file:fi.eis.applications.helpers.ServerOsgiBundleXmlWebApplicationContext.java

@Override
protected ConfigurableEnvironment createEnvironment() {
    return new StandardServletEnvironment();
}

From source file:org.codehaus.groovy.grails.support.MockApplicationContext.java

public Environment getEnvironment() {
    return new StandardServletEnvironment();
}

From source file:org.springframework.boot.SpringApplication.java

private ConfigurableEnvironment getOrCreateEnvironment() {
    if (this.environment != null) {
        return this.environment;
    }/*w  ww .  j  a v a2  s  .c o m*/
    if (this.webEnvironment) {
        return new StandardServletEnvironment();
    }
    return new StandardEnvironment();

}

From source file:org.springframework.web.filter.GenericFilterBean.java

/**
 * Create and return a new {@link StandardServletEnvironment}.
 * <p>Subclasses may override this in order to configure the environment or
 * specialize the environment type returned.
 * @since 4.3.9/*from   w w  w  .  j  a  v a 2s .  c  om*/
 */
protected Environment createEnvironment() {
    return new StandardServletEnvironment();
}

From source file:org.springframework.web.filter.GenericFilterBean.java

/**
 * Standard way of initializing this filter.
 * Map config parameters onto bean properties of this filter, and
 * invoke subclass initialization./*w w w  .  ja  v a2  s  . c o  m*/
 * @param filterConfig the configuration for this filter
 * @throws ServletException if bean properties are invalid (or required
 * properties are missing), or if subclass initialization fails.
 * @see #initFilterBean
 */
@Override
public final void init(FilterConfig filterConfig) throws ServletException {
    Assert.notNull(filterConfig, "FilterConfig must not be null");
    if (logger.isDebugEnabled()) {
        logger.debug("Initializing filter '" + filterConfig.getFilterName() + "'");
    }

    this.filterConfig = filterConfig;

    // Set bean properties from init parameters.
    PropertyValues pvs = new FilterConfigPropertyValues(filterConfig, this.requiredProperties);
    if (!pvs.isEmpty()) {
        try {
            BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
            ResourceLoader resourceLoader = new ServletContextResourceLoader(filterConfig.getServletContext());
            Environment env = this.environment;
            if (env == null) {
                env = new StandardServletEnvironment();
            }
            bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, env));
            initBeanWrapper(bw);
            bw.setPropertyValues(pvs, true);
        } catch (BeansException ex) {
            String msg = "Failed to set bean properties on filter '" + filterConfig.getFilterName() + "': "
                    + ex.getMessage();
            logger.error(msg, ex);
            throw new NestedServletException(msg, ex);
        }
    }

    // Let subclasses do whatever initialization they like.
    initFilterBean();

    if (logger.isDebugEnabled()) {
        logger.debug("Filter '" + filterConfig.getFilterName() + "' configured successfully");
    }
}

From source file:org.springframework.web.servlet.HttpServletBean.java

/**
 * Create and return a new {@link StandardServletEnvironment}.
 * <p>Subclasses may override this in order to configure the environment or
 * specialize the environment type returned.
 *///from   www  .  ja v  a  2  s . c o  m
protected ConfigurableEnvironment createEnvironment() {
    return new StandardServletEnvironment();
}