Example usage for org.springframework.web.servlet.config.annotation ResourceHandlerRegistry hasMappingForPattern

List of usage examples for org.springframework.web.servlet.config.annotation ResourceHandlerRegistry hasMappingForPattern

Introduction

In this page you can find the example usage for org.springframework.web.servlet.config.annotation ResourceHandlerRegistry hasMappingForPattern.

Prototype

public boolean hasMappingForPattern(String pathPattern) 

Source Link

Document

Whether a resource handler has already been registered for the given path pattern.

Usage

From source file:net.paulgray.mocklti2.config.WebConfig.java

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    if (!registry.hasMappingForPattern("/assets/**")) {
        registry.addResourceHandler("/assets/**").addResourceLocations("WEB-INF/assets/");
    }//  w w w .j  av a2 s. c  om
}

From source file:com.ethercamp.harmony.config.ApplicationConfig.java

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }//from w  w w  .j  a  v a2  s .  c om
}

From source file:com.baidu.oped.sia.boot.springfox.SpringFoxAutoConfiguration.java

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    final String prefixWebJarsPattern = "/webjars/**";
    if (!registry.hasMappingForPattern(prefixWebJarsPattern)) {
        registry.addResourceHandler(prefixWebJarsPattern)
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }//from   w  w  w  .j a v  a2s.c  o m

    final String swaggerEndpoint = "/swagger-ui.html";
    registry.addResourceHandler(swaggerEndpoint)
            .addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
}

From source file:org.bonitasoft.web.designer.config.WebMvcConfiguration.java

/**
 * Add resources handler to help Spring to manage our static resources (from frontend and backend)
 *//* w  w  w  .j  a v  a 2s. c  om*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {

    if (!registry.hasMappingForPattern("/i18n/*")) {
        registry.addResourceHandler("/i18n/*").addResourceLocations("classpath:/i18n/");
    }

    if (!registry.hasMappingForPattern("/widgets/**")) {
        registry.addResourceHandler("/widgets/**").addResourceLocations(WIDGETS_RESOURCES);
    }

    if (!registry.hasMappingForPattern("/**")) {
        registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
    }
}

From source file:com.epam.ta.reportportal.core.configs.MvcConfig.java

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    if (!registry.hasMappingForPattern("/**")) {
        registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
    }/*from   ww  w . j  a  v a  2  s.  c  o  m*/
    if (!registry.hasMappingForPattern("/webjars/**")) {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}

From source file:com.sendish.api.SwaggerConfig.java

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    Integer cachePeriod = this.resourceProperties.getCachePeriod();

    if (!registry.hasMappingForPattern("/swagger-ui/**")) {
        registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/resources/swagger-ui/")
                .setCachePeriod(cachePeriod);
    }//from  w  ww  .ja  v a2  s .  c om
}

From source file:org.ownchan.server.app.config.WebMvcConfig.java

private void addStaticResourceHandlers(ResourceHandlerRegistry registry, CacheControl cacheControl,
        String... patterns) {/*w ww .j a va2s. c  o m*/
    Stream.of(patterns).filter(pattern -> !registry.hasMappingForPattern(pattern))
            .map(registry::addResourceHandler).forEach(handler -> handler
                    .addResourceLocations("classpath:/webstatic/").setCacheControl(cacheControl));
}