當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。