Example usage for javax.servlet FilterRegistration.Dynamic getName

List of usage examples for javax.servlet FilterRegistration.Dynamic getName

Introduction

In this page you can find the example usage for javax.servlet FilterRegistration.Dynamic getName.

Prototype

public String getName();

Source Link

Document

Gets the name of the Servlet or Filter that is represented by this Registration.

Usage

From source file:org.springframework.boot.context.embedded.AbstractFilterRegistrationBean.java

/**
 * Configure registration settings. Subclasses can override this method to perform
 * additional configuration if required.
 * @param registration the registration//from w  w  w .  java 2  s. c o  m
 */
protected void configure(FilterRegistration.Dynamic registration) {
    super.configure(registration);
    EnumSet<DispatcherType> dispatcherTypes = this.dispatcherTypes;
    if (dispatcherTypes == null) {
        dispatcherTypes = (isAsyncSupported() ? ASYNC_DISPATCHER_TYPES : NON_ASYNC_DISPATCHER_TYPES);
    }
    Set<String> servletNames = new LinkedHashSet<String>();
    for (ServletRegistrationBean servletRegistrationBean : this.servletRegistrationBeans) {
        servletNames.add(servletRegistrationBean.getServletName());
    }
    servletNames.addAll(this.servletNames);
    if (servletNames.isEmpty() && this.urlPatterns.isEmpty()) {
        this.logger.info(
                "Mapping filter: '" + registration.getName() + "' to: " + Arrays.asList(DEFAULT_URL_MAPPINGS));
        registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter, DEFAULT_URL_MAPPINGS);
    } else {
        if (servletNames.size() > 0) {
            this.logger.info("Mapping filter: '" + registration.getName() + "' to servlets: " + servletNames);
            registration.addMappingForServletNames(dispatcherTypes, this.matchAfter,
                    servletNames.toArray(new String[servletNames.size()]));
        }
        if (this.urlPatterns.size() > 0) {
            this.logger.info("Mapping filter: '" + registration.getName() + "' to urls: " + this.urlPatterns);
            registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter,
                    this.urlPatterns.toArray(new String[this.urlPatterns.size()]));
        }
    }
}

From source file:org.springframework.boot.context.embedded.FilterRegistrationBean.java

/**
 * Configure registration settings. Subclasses can override this method to perform
 * additional configuration if required.
 * @param registration the registration/*from ww  w .  j av  a2  s  .  co m*/
 */
protected void configure(FilterRegistration.Dynamic registration) {
    super.configure(registration);
    EnumSet<DispatcherType> dispatcherTypes = this.dispatcherTypes;
    if (dispatcherTypes == null) {
        dispatcherTypes = (isAsyncSupported() ? ASYNC_DISPATCHER_TYPES : NON_ASYNC_DISPATCHER_TYPES);
    }

    Set<String> servletNames = new LinkedHashSet<String>();
    for (ServletRegistrationBean servletRegistrationBean : this.servletRegistrationBeans) {
        servletNames.add(servletRegistrationBean.getServletName());
    }
    servletNames.addAll(this.servletNames);

    if (servletNames.isEmpty() && this.urlPatterns.isEmpty()) {
        logger.info(
                "Mapping filter: '" + registration.getName() + "' to: " + Arrays.asList(DEFAULT_URL_MAPPINGS));
        registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter, DEFAULT_URL_MAPPINGS);
    } else {
        if (servletNames.size() > 0) {
            logger.info("Mapping filter: '" + registration.getName() + "' to servlets: " + servletNames);
            registration.addMappingForServletNames(dispatcherTypes, this.matchAfter,
                    servletNames.toArray(new String[servletNames.size()]));
        }
        if (this.urlPatterns.size() > 0) {
            logger.info("Mapping filter: '" + registration.getName() + "' to urls: " + this.urlPatterns);
            registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter,
                    this.urlPatterns.toArray(new String[this.urlPatterns.size()]));
        }
    }
}

From source file:org.springframework.boot.web.servlet.AbstractFilterRegistrationBean.java

/**
 * Configure registration settings. Subclasses can override this method to perform
 * additional configuration if required.
 * @param registration the registration/*from w w  w. j ava2  s .com*/
 */
protected void configure(FilterRegistration.Dynamic registration) {
    super.configure(registration);
    EnumSet<DispatcherType> dispatcherTypes = this.dispatcherTypes;
    if (dispatcherTypes == null) {
        dispatcherTypes = (isAsyncSupported() ? ASYNC_DISPATCHER_TYPES : NON_ASYNC_DISPATCHER_TYPES);
    }
    Set<String> servletNames = new LinkedHashSet<String>();
    for (ServletRegistrationBean servletRegistrationBean : this.servletRegistrationBeans) {
        servletNames.add(servletRegistrationBean.getServletName());
    }
    servletNames.addAll(this.servletNames);
    if (servletNames.isEmpty() && this.urlPatterns.isEmpty()) {
        this.logger.info(
                "Mapping filter: '" + registration.getName() + "' to: " + Arrays.asList(DEFAULT_URL_MAPPINGS));
        registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter, DEFAULT_URL_MAPPINGS);
    } else {
        if (!servletNames.isEmpty()) {
            this.logger.info("Mapping filter: '" + registration.getName() + "' to servlets: " + servletNames);
            registration.addMappingForServletNames(dispatcherTypes, this.matchAfter,
                    servletNames.toArray(new String[servletNames.size()]));
        }
        if (!this.urlPatterns.isEmpty()) {
            this.logger.info("Mapping filter: '" + registration.getName() + "' to urls: " + this.urlPatterns);
            registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter,
                    this.urlPatterns.toArray(new String[this.urlPatterns.size()]));
        }
    }
}