當前位置: 首頁>>代碼示例>>Java>>正文


Java CorsRegistry.addMapping方法代碼示例

本文整理匯總了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");
			}
		}
	};
}
 
開發者ID:yonadev,項目名稱:yona-server,代碼行數:17,代碼來源:AppServiceApplication.java

示例2: addCorsMappings

import org.springframework.web.servlet.config.annotation.CorsRegistry; //導入方法依賴的package包/類
@Override
public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/api/v1/**");
}
 
開發者ID:cuiods,項目名稱:WIFIProbe,代碼行數:5,代碼來源:WebMvcConfig.java

示例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("/**");
        }
    };
}
 
開發者ID:backpaper0,項目名稱:spring-boot-vue-simple-sample,代碼行數:11,代碼來源:DemoApplication.java

示例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);
    }
 
開發者ID:sdcuike,項目名稱:spring-boot-oauth2-demo,代碼行數:10,代碼來源:MvcConfig.java

示例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("/**");
}
 
開發者ID:metasfresh,項目名稱:metasfresh-webui-api,代碼行數:13,代碼來源:WebConfig.java

示例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);
        }
    };
}
 
開發者ID:oembedler,項目名稱:graphql-spring-boot,代碼行數:11,代碼來源:GraphQLWebAutoConfiguration.java

示例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("/**/**");
        }
    };
}
 
開發者ID:shairontoledo,項目名稱:cloudstatus,代碼行數:13,代碼來源:Application.java

示例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/**");
        }
    };
}
 
開發者ID:IIDP,項目名稱:OSTMap,代碼行數:15,代碼來源:MainController.java

示例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("/**");
        }
    };
}
 
開發者ID:yahoo,項目名稱:bullet-service,代碼行數:15,代碼來源:APIConfiguration.java

示例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/**");
        }
    };
}
 
開發者ID:EMBL-EBI-SUBS-OLD,項目名稱:subs,代碼行數:10,代碼來源:CORSConfiguration.java

示例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("/**");
    }
  };
}
 
開發者ID:holisticon,項目名稱:camunda-bpm-cloud,代碼行數:10,代碼來源:WorkloadQueryServiceApplication.java

示例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("/**");
        }
    };
}
 
開發者ID:ClouDesire,項目名稱:janine,代碼行數:10,代碼來源:WebConfiguration.java

示例13: addCorsMappings

import org.springframework.web.servlet.config.annotation.CorsRegistry; //導入方法依賴的package包/類
@Override
public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/**/*");
}
 
開發者ID:BBVA,項目名稱:mirrorgate,代碼行數:5,代碼來源:WebMvcConfigurerAdapterImpl.java

示例14: addCorsMappings

import org.springframework.web.servlet.config.annotation.CorsRegistry; //導入方法依賴的package包/類
@Override
public void addCorsMappings(CorsRegistry registry) {
    registry.addMapping("/**");
}
 
開發者ID:Eagle-OJ,項目名稱:eagle-oj-api,代碼行數:5,代碼來源:WebMvcConfigurer.java

示例15: addCorsMappings

import org.springframework.web.servlet.config.annotation.CorsRegistry; //導入方法依賴的package包/類
@Override
public void addCorsMappings(CorsRegistry registry) {
    registry
        .addMapping("/**");
}
 
開發者ID:BakkerTom,項目名稱:happy-news,代碼行數:6,代碼來源:WebMvcConfig.java


注:本文中的org.springframework.web.servlet.config.annotation.CorsRegistry.addMapping方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。