Example usage for org.springframework.web.servlet.config.annotation CorsRegistry addMapping

List of usage examples for org.springframework.web.servlet.config.annotation CorsRegistry addMapping

Introduction

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

Prototype

public CorsRegistration addMapping(String pathPattern) 

Source Link

Document

Enable cross-origin request handling for the specified path pattern.

Usage

From source file:org.farrukh.examples.rest.Application.java

@Bean
public WebMvcConfigurer mvcCORSConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override//from   w w w.ja  va  2s .  co m
        public void addCorsMappings(final CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*").allowedMethods("GET").maxAge(MAX_AGE)
                    .allowCredentials(true);
        }
    };
}

From source file:com.devnexus.ting.config.WebConfig.java

@Override
public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/**").allowedOrigins("*");
}

From source file:com.oembedler.moon.graphql.boot.GraphQLWebAutoConfiguration.java

@Bean
@ConditionalOnProperty(value = "graphql.server.corsEnabled", havingValue = "true", matchIfMissing = true)
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override/*from w w w  .j av a 2 s .c  o m*/
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping(graphQLServerMapping);
        }
    };
}

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

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override//from   ww  w  .  jav  a2s . co  m
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**");
        }
    };
}

From source file:ch.ge.ve.protopoc.config.WebSecurityConfigurer.java

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override//from w w w.j  ava2s. c o  m
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedMethods("GET", "POST", "OPTIONS").allowedOrigins("*");
        }
    };
}

From source file:cn.zhangxd.platform.common.web.config.WebConfig.java

@Override
public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/**").allowedHeaders("*").allowedMethods("*").allowedOrigins("*");
}

From source file:com.deicos.lince.Initializer.java

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override// w w  w  .j av  a 2  s . com
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/*").allowedOrigins(getServerURL());
        }
    };
}

From source file:com.orange.clara.tool.config.AppConfig.java

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override//ww w  . jav  a 2s.c  om
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*").allowedHeaders("x-auth-token", "x-requested-with");
        }
    };
}

From source file:nu.yona.server.AppServiceApplication.java

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override/*w w w . j a v  a 2  s  .c om*/
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/swagger/swagger-spec.yaml");
            if (yonaProperties.getSecurity().isCorsAllowed()) {
                // Enable CORS for the other resources, to allow testing the API through Swagger UI.
                registry.addMapping("/**").allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE");
            }
        }
    };
}

From source file:de.unimannheim.spa.process.config.InMemoryConfig.java

@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override// w  w w  .  j  av a 2 s.  c  o  m
        public void addCorsMappings(CorsRegistry registry) {
            /**
             * Global CORS configuration which
             * enables all Cross Origin Requests
             */
            registry.addMapping("/**");
        }
    };
}