本文整理汇总了Java中org.springframework.web.servlet.config.annotation.CorsRegistry.addMapping方法的典型用法代码示例。如果您正苦于以下问题:Java CorsRegistry.addMapping方法的具体用法?Java CorsRegistry.addMapping怎么用?Java CorsRegistry.addMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.config.annotation.CorsRegistry
的用法示例。
在下文中一共展示了CorsRegistry.addMapping方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
public WebMvcConfigurer corsConfigurer()
{
return new WebMvcConfigurerAdapter() {
@Override
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");
}
}
};
}
示例2: addCorsMappings
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/v1/**");
}
示例3: webMvcConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
@Conditional(Development.class)
public WebMvcConfigurer webMvcConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
示例4: addCorsMappings
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
// .allowedOrigins("http://domain2.com")
// .allowedMethods("PUT", "DELETE")
// .allowedHeaders("header1", "header2", "header3")
// .exposedHeaders("header1", "header2")
// .allowCredentials(false).maxAge(3600);
}
示例5: addCorsMappings
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@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("/**");
}
示例6: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
@ConditionalOnProperty(value = "graphql.server.corsEnabled", havingValue = "true", matchIfMissing = true)
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping(graphQLServerMapping);
}
};
}
示例7: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/services/**");
registry.addMapping("*/*");
registry.addMapping("/**");
registry.addMapping("/**/**");
}
};
}
示例8: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
/**
* Global enable CORS for all mappings /api/**
*
* @return
*/
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**");
}
};
}
示例9: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
/**
* Enables CORS globally.
*
* @return A {@link WebMvcConfigurer} instance with default CORS configuration - allow everything.
*/
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
示例10: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**");
}
};
}
示例11: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(final CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
示例12: corsConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
示例13: addCorsMappings
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**/*");
}
示例14: addCorsMappings
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
示例15: addCorsMappings
import org.springframework.web.servlet.config.annotation.CorsRegistry; //导入方法依赖的package包/类
@Override
public void addCorsMappings(CorsRegistry registry) {
registry
.addMapping("/**");
}