Java Code Examples for org.springframework.web.servlet.config.annotation.CorsRegistry#addMapping()
The following examples show how to use
org.springframework.web.servlet.config.annotation.CorsRegistry#addMapping() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyConfiguration.java From java-interview with Apache License 2.0 | 5 votes |
@Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { // 设置允许跨域的请求规则 registry.addMapping("/api/**"); } }; }
Example 2
Source File: WebConfig.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 5 votes |
@Override public void addCorsMappings(final CorsRegistry registry) { // FIXME: for now we enable CORS for the whole REST API // registry.addMapping(ENDPOINT_ROOT + "/**"); // NOTE: this seems to not work (i.e. headers are not added), so: // pls check de.metas.ui.web.config.CORSFilter.doFilter(ServletRequest, ServletResponse, FilterChain) // because we are setting the headers there... and that works! registry.addMapping("/**"); }
Example 3
Source File: ServletConfig.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 5 votes |
@Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { CorsRegistration reg = registry.addMapping("/api/**"); reg.allowedOrigins("*"); } }; }
Example 4
Source File: MyConfiguration.java From servicecomb-pack with Apache License 2.0 | 5 votes |
@Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); } }; }
Example 5
Source File: WebConfigCORS.java From pacbot with Apache License 2.0 | 5 votes |
/** * Cors configurer. * * @return the web mvc configurer */ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { if ("all".equals(allowedOrigions)) { registry.addMapping("/**"); } else { registry.addMapping("/**").allowedOrigins(allowedOrigions); } } }; }
Example 6
Source File: ContainerApplication.java From tac with MIT License | 5 votes |
@Bean public WebMvcConfigurer webMvcConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/api/**"); } }; }
Example 7
Source File: WebMvcConfig.java From AnyMock with Apache License 2.0 | 5 votes |
@Bean public WebMvcConfigurer crossOriginConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**/*"); } }; }
Example 8
Source File: WebMvcConfig.java From AnyMock with Apache License 2.0 | 5 votes |
@Bean public WebMvcConfigurer crossOriginConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping(URL_PREFIX_API_V2_PATTERN); } }; }
Example 9
Source File: ServletConfig.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 5 votes |
@Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { CorsRegistration reg = registry.addMapping("/api/**"); reg.allowedOrigins("*"); } }; }
Example 10
Source File: MVCConf.java From springboot-plus with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); }
Example 11
Source File: WebMvcConfig.java From konker-platform with Apache License 2.0 | 4 votes |
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); }
Example 12
Source File: WebConfigAdaptor.java From redtorch with MIT License | 4 votes |
/** * 允许跨域访问 */ @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); }
Example 13
Source File: WebConfigProduction.java From Library with MIT License | 4 votes |
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); }
Example 14
Source File: WebMvcConfig.java From WIFIProbe with Apache License 2.0 | 4 votes |
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/api/v1/**"); }
Example 15
Source File: WebMvcConfig.java From WIFIProbe with Apache License 2.0 | 4 votes |
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/api/v1/**"); }
Example 16
Source File: WebConfiguration.java From spring-microservices with MIT License | 4 votes |
@Override public void addCorsMappings(final CorsRegistry registry) { registry.addMapping("/**"); }
Example 17
Source File: WebMvcConfig.java From konker-platform with Apache License 2.0 | 4 votes |
@Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); }
Example 18
Source File: AppConfig.java From swagger-aem with Apache License 2.0 | 3 votes |
/** * enabling cors support at global level which can be applied at various * level also as below registry.addMapping("/api/**") * .allowedOrigins("http://domain2.com") .allowedMethods("PUT", "DELETE") * .allowedHeaders("header1", "header2", "header3") * .exposedHeaders("header1", "header2") * .allowCredentials(false).maxAge(3600); * * @return */ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); } }; }
Example 19
Source File: AppConfig.java From openapi-generator with Apache License 2.0 | 3 votes |
/** * enabling cors support at global level which can be applied at various * level also as below registry.addMapping("/api/**") * .allowedOrigins("http://domain2.com") .allowedMethods("PUT", "DELETE") * .allowedHeaders("header1", "header2", "header3") * .exposedHeaders("header1", "header2") * .allowCredentials(false).maxAge(3600); * * @return a new WebMvcConfigurer instance */ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); } }; }
Example 20
Source File: AppConfig.java From swaggy-jenkins with MIT License | 3 votes |
/** * enabling cors support at global level which can be applied at various * level also as below registry.addMapping("/api/**") * .allowedOrigins("http://domain2.com") .allowedMethods("PUT", "DELETE") * .allowedHeaders("header1", "header2", "header3") * .exposedHeaders("header1", "header2") * .allowCredentials(false).maxAge(3600); * * @return */ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurerAdapter() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); } }; }