当前位置: 首页>>代码示例>>Java>>正文


Java FilterRegistrationBean.setOrder方法代码示例

本文整理汇总了Java中org.springframework.boot.web.servlet.FilterRegistrationBean.setOrder方法的典型用法代码示例。如果您正苦于以下问题:Java FilterRegistrationBean.setOrder方法的具体用法?Java FilterRegistrationBean.setOrder怎么用?Java FilterRegistrationBean.setOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.boot.web.servlet.FilterRegistrationBean的用法示例。


在下文中一共展示了FilterRegistrationBean.setOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: corsFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
FilterRegistrationBean corsFilter() {
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.addAllowedOrigin("*");
    config.addAllowedHeader("*");
    config.addAllowedMethod("*");

    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    source.registerCorsConfiguration("/**", config);

    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE);

    return bean;
}
 
开发者ID:BakkerTom,项目名称:happy-news,代码行数:17,代码来源:AuthorizationServerConfig.java

示例2: corsFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean corsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();

    config.setAllowCredentials(true);
    config.addAllowedOrigin("*");
    config.addAllowedHeader("*");

    config.addExposedHeader("WWW-Authenticate");
    config.addExposedHeader("Access-Control-Allow-Origin");
    config.addExposedHeader("Access-Control-Allow-Headers");

    config.addAllowedMethod("OPTIONS");
    config.addAllowedMethod("HEAD");
    config.addAllowedMethod("GET");
    config.addAllowedMethod("PUT");
    config.addAllowedMethod("POST");
    config.addAllowedMethod("DELETE");
    config.addAllowedMethod("PATCH");
    source.registerCorsConfiguration("/**", config);

    final FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(0);
    return bean;
}
 
开发者ID:evoila,项目名称:cfsummiteu2017,代码行数:27,代码来源:BaseConfiguration.java

示例3: corsFilterBean

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
/**
 * <a href="https://github.com/spring-projects/spring-boot/issues/5834#issuecomment-296370088">See explanation here</a>
 */
@Bean
public FilterRegistrationBean corsFilterBean() {
	final CorsConfiguration configuration = new CorsConfiguration();
	configuration.setAllowedOrigins(Collections.singletonList("*"));
	configuration.setAllowedMethods(Arrays.asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH"));
	// setAllowCredentials(true) is important, otherwise:
	// The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
	configuration.setAllowCredentials(true);
	// setAllowedHeaders is important! Without it, OPTIONS preflight request
	// will fail with 403 Invalid CORS request
	configuration.setAllowedHeaders(Arrays.asList("Authorization", "Cache-Control", "Content-Type"));
	final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
	source.registerCorsConfiguration("/**", configuration);
	FilterRegistrationBean corsFilter = new FilterRegistrationBean(new CorsFilter(source));
	corsFilter.setOrder(Ordered.HIGHEST_PRECEDENCE);
	return corsFilter;
}
 
开发者ID:codenergic,项目名称:theskeleton,代码行数:21,代码来源:WebSecurityConfig.java

示例4: setRestApiFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean setRestApiFilter() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(historyFilter);
    registration.addUrlPatterns("/api/engine/engine/default/task/*");
    registration.setName("historyFilter");
    registration.setOrder(Integer.MAX_VALUE - 1);
    return registration;
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:10,代码来源:Config.java

示例5: someFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
/**
 * Some filter registration filter registration bean.
 *
 * @return the filter registration bean
 */
@Bean
public FilterRegistrationBean someFilterRegistration() {
    final FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(etagFilter());
    registration.addUrlPatterns("/api/*");
    registration.setName("etagFilter");
    registration.setOrder(1);
    return registration;
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:15,代码来源:SpringConfig.java

示例6: corsFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean corsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.addAllowedOrigin("*");
    config.addAllowedHeader("*");
    config.addAllowedMethod("*");
    source.registerCorsConfiguration("/**", config);
    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(0);
    return bean;
}
 
开发者ID:Taskana,项目名称:taskana,代码行数:14,代码来源:WebSecurityConfig.java

示例7: filterRegistrationBean

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean filterRegistrationBean() {
    FilterRegistrationBean registration = new FilterRegistrationBean(new SessionFilter(this));
    registration.addUrlPatterns("/*");
    registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return registration;
}
 
开发者ID:onepiecex,项目名称:session-share,代码行数:8,代码来源:SpringSessionShareConfig.java

示例8: corsFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean corsFilter() {
    UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
    CorsConfiguration config = new CorsConfiguration();
    config.setAllowCredentials(true);
    config.addAllowedOrigin("*");
    config.addAllowedHeader("*");
    config.addAllowedMethod("*");
    source.registerCorsConfiguration("/**/bundle.json", config);
    FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
    bean.setOrder(0);
    return bean;
}
 
开发者ID:symphonyoss,项目名称:app-auth-example,代码行数:14,代码来源:CorsFilterConfig.java

示例9: objectifyFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean objectifyFilter(){
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new ObjectifyFilter());
    registration.addUrlPatterns("/*");
    registration.setOrder(1);

    return registration;
}
 
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:10,代码来源:ExampleApp.java

示例10: corsFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean corsFilter() {
    UrlBasedCorsConfigurationSource source =
            new UrlBasedCorsConfigurationSource();
    CorsConfiguration config =
            new CorsConfiguration().applyPermitDefaultValues();
    config.addAllowedMethod(HttpMethod.PUT);
    config.addAllowedMethod(HttpMethod.PATCH);
    config.addAllowedMethod(HttpMethod.DELETE);
    source.registerCorsConfiguration("/**", config);
    FilterRegistrationBean bean = new FilterRegistrationBean(
            new CorsFilter(source));
    bean.setOrder(0);
    return bean;
}
 
开发者ID:ceefour,项目名称:java-web-services-training,代码行数:16,代码来源:RestConfig.java

示例11: restFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean restFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(restFilter());
    registration.addUrlPatterns("/rest/*");
    registration.setName("RESTFilter");
    registration.setOrder(3);
    return registration;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:10,代码来源:Application.java

示例12: oauth2ClientFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean oauth2ClientFilterRegistration(
        OAuth2ClientContextFilter filter) {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(filter);
    registration.setOrder(-100);
    return registration;
}
 
开发者ID:Microsoft,项目名称:movie-db-java-on-azure,代码行数:9,代码来源:SecurityConfig.java

示例13: characterEncodingFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean characterEncodingFilterRegistration() {
    FilterRegistrationBean registrationBean =
            new FilterRegistrationBean(characterEncodingFilter());
    registrationBean.setName("CharacterEncodingFilter");
    registrationBean.addUrlPatterns("/*");
    registrationBean.setOrder(1);
    return registrationBean;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:10,代码来源:CasConfig.java

示例14: xssFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean xssFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setDispatcherTypes(DispatcherType.REQUEST);
    registration.setFilter(new XssFilter());
    registration.addUrlPatterns("/*");
    registration.setName("xssFilter");
    registration.setOrder(Integer.MAX_VALUE);
    return registration;
}
 
开发者ID:guolf,项目名称:pds,代码行数:11,代码来源:FilterConfig.java

示例15: xAPIValidationFilterBean

import org.springframework.boot.web.servlet.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean xAPIValidationFilterBean() {
  FilterRegistrationBean registrationBean = new FilterRegistrationBean();
  registrationBean.setFilter(xAPIRequestValidationFilter);
  List<String> urls = new ArrayList<String>(1);
  urls.add("/xAPI/*");
  registrationBean.setUrlPatterns(urls);
  registrationBean.setOrder(3);
  return registrationBean;
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:11,代码来源:WebSecurityConfig.java


注:本文中的org.springframework.boot.web.servlet.FilterRegistrationBean.setOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。