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


Java FilterRegistrationBean.addUrlPatterns方法代碼示例

本文整理匯總了Java中org.springframework.boot.context.embedded.FilterRegistrationBean.addUrlPatterns方法的典型用法代碼示例。如果您正苦於以下問題:Java FilterRegistrationBean.addUrlPatterns方法的具體用法?Java FilterRegistrationBean.addUrlPatterns怎麽用?Java FilterRegistrationBean.addUrlPatterns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.context.embedded.FilterRegistrationBean的用法示例。


在下文中一共展示了FilterRegistrationBean.addUrlPatterns方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: filterRegistrationBean

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean filterRegistrationBean() {
    final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();

    final CorsConfiguration corsConfiguration = new CorsConfiguration();
    corsConfiguration.setAllowCredentials(corsSupportProperties.isAllowCredentials());
    corsConfiguration.addAllowedOrigin(corsSupportProperties.getAllowOrigin());
    corsConfiguration.addAllowedHeader(corsSupportProperties.getAllowHeader());
    corsConfiguration.addAllowedMethod(corsSupportProperties.getAllowMethod());

    urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);

    CorsFilter corsFilter = new CorsFilter(urlBasedCorsConfigurationSource);
    FilterRegistrationBean registration = new FilterRegistrationBean(corsFilter);
    registration.addUrlPatterns("/*");
    registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return registration;
}
 
開發者ID:melthaw,項目名稱:spring-backend-boilerplate,代碼行數:19,代碼來源:CorsSupportConfiguration.java

示例2: wicketFilterRegistration

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean wicketFilterRegistration() {

	FilterRegistrationBean registration = new FilterRegistrationBean();
	WicketFilter wicketFilter = new WicketFilter();
	registration.setFilter(wicketFilter);
	registration.setName("wicketFilter");
	registration.addInitParameter(WicketFilter.APP_FACT_PARAM,
			SpringWebApplicationFactory.class.getName());
	registration.addInitParameter("configuration", configuration);
	registration.addInitParameter("testsMode", String.valueOf(testMode));
	registration.addInitParameter("mockMode",String.valueOf(mockMode));
	registration.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/portal/*");
	registration.addInitParameter(WicketFilter.IGNORE_PATHS_PARAM,"/favicon.ico");
	registration.addUrlPatterns("/portal/*");
	registration.setDispatcherTypes(DispatcherType.REQUEST,DispatcherType.FORWARD);
	registration.setMatchAfter(true);


	return registration;
}
 
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:22,代碼來源:WicketWebInitializer.java

示例3: xssFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean xssFilter() {
	FilterRegistrationBean registration = new FilterRegistrationBean(new XssFilter());

	// Default values if not set
	if (properties.getUrlPattern() == null ||  properties.getUrlPattern().isEmpty()){
		properties.setUrlPattern(DEFAULT_URL_PATTERN);
	}
	if (properties.getMatch() == null ||  properties.getMatch().isEmpty()){
		properties.setMatch(DEFAULT_MATCH);
	}
	if (properties.getExclude() == null ||  properties.getExclude().isEmpty()){
		properties.setExclude(DEFAULT_EXCLUDE);
	}
	if (properties.getWildcards() == null){
		properties.setWildcards(DEFAULT_WILCARDS);
	}
	registration.addUrlPatterns(properties.getUrlPattern());
	registration.setInitParameters(properties.getAsInitParameters());
	return registration;
}
 
開發者ID:Appverse,項目名稱:appverse-server,代碼行數:22,代碼來源:XssFilterAutoConfiguration.java

示例4: authenticationFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean authenticationFilter() {
  FilterRegistrationBean casFilter = new FilterRegistrationBean();

  Map<String, String> filterInitParam = Maps.newHashMap();
  filterInitParam.put("redisClusterName", "casClientPrincipal");
  filterInitParam.put("serverName", portalConfig.portalServerName());
  filterInitParam.put("casServerLoginUrl", portalConfig.casServerLoginUrl());
  //we don't want to use session to store login information, since we will be deployed to a cluster, not a single instance
  filterInitParam.put("useSession", "false");
  filterInitParam.put("/openapi.*", "exclude");

  casFilter.setInitParameters(filterInitParam);
  casFilter.setFilter(filter("com.ctrip.framework.apollo.sso.filter.ApolloAuthenticationFilter"));
  casFilter.addUrlPatterns("/*");
  casFilter.setOrder(2);

  return casFilter;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:20,代碼來源:AuthConfiguration.java

示例5: httpMethodFilterRegistration

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean httpMethodFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(httpMethodFilter());
    registration.addUrlPatterns("/*");
    registration.setName("httpMethodFilter");
    registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
    return registration;
}
 
開發者ID:melthaw,項目名稱:spring-backend-boilerplate,代碼行數:10,代碼來源:OpenApiWebMvcConfigurer.java

示例6: openApiAuthenticationFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean openApiAuthenticationFilter(ConsumerAuthUtil consumerAuthUtil,
                                                          ConsumerAuditUtil consumerAuditUtil) {
  FilterRegistrationBean openApiFilter = new FilterRegistrationBean();

  openApiFilter.setFilter(new ConsumerAuthenticationFilter(consumerAuthUtil, consumerAuditUtil));
  openApiFilter.addUrlPatterns("/openapi/*");

  return openApiFilter;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:11,代碼來源:AuthFilterConfiguration.java

示例7: casFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean casFilter() {
  FilterRegistrationBean singleSignOutFilter = new FilterRegistrationBean();
  singleSignOutFilter.setFilter(filter("org.jasig.cas.client.session.SingleSignOutFilter"));
  singleSignOutFilter.addUrlPatterns("/*");
  singleSignOutFilter.setOrder(1);
  return singleSignOutFilter;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:9,代碼來源:AuthConfiguration.java

示例8: assertionHolder

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean assertionHolder() {
  FilterRegistrationBean assertionHolderFilter = new FilterRegistrationBean();

  Map<String, String> filterInitParam = Maps.newHashMap();
  filterInitParam.put("/openapi.*", "exclude");

  assertionHolderFilter.setInitParameters(filterInitParam);

  assertionHolderFilter.setFilter(filter("com.ctrip.framework.apollo.sso.filter.ApolloAssertionThreadLocalFilter"));
  assertionHolderFilter.addUrlPatterns("/*");
  assertionHolderFilter.setOrder(4);

  return assertionHolderFilter;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:16,代碼來源:AuthConfiguration.java

示例9: userAccessFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean userAccessFilter() {
  FilterRegistrationBean filter = new FilterRegistrationBean();
  filter.setFilter(new UserAccessFilter(userInfoHolder));
  filter.addUrlPatterns("/*");
  return filter;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:8,代碼來源:WebContextConfiguration.java

示例10: encodingFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
  public FilterRegistrationBean encodingFilter() {
    FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new CharacterEncodingFilter());
    bean.addInitParameter("encoding", "UTF-8");
    //FIXME: https://github.com/Netflix/eureka/issues/702
//    bean.addInitParameter("forceEncoding", "true");
    bean.setName("encodingFilter");
    bean.addUrlPatterns("/*");
    bean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD);
    return bean;
  }
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:13,代碼來源:CharacterEncodingFilterConfiguration.java

示例11: filterRegistrationBean

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
@DependsOn("securityManager")
@ConditionalOnMissingBean
public FilterRegistrationBean filterRegistrationBean(SecurityManager securityManager) throws Exception {
    FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
    //該值缺省為false,表示生命周期由SpringApplicationContext管理,設置為true則表示由ServletContainer管理
    filterRegistration.addInitParameter("targetFilterLifecycle", "true");
    filterRegistration.setFilter((Filter) getShiroFilterFactoryBean(securityManager).getObject());
    filterRegistration.setEnabled(true);
    filterRegistration.addUrlPatterns("/*");
    return filterRegistration;
}
 
開發者ID:johntostring,項目名稱:spring-boot-shiro,代碼行數:13,代碼來源:ShiroAutoConfiguration.java

示例12: webStatFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
/**
 * druid的url監控
 * @return
 */
@Bean
public FilterRegistrationBean webStatFilter(){
	WebStatFilter filter = new WebStatFilter();
	FilterRegistrationBean bean = new FilterRegistrationBean(filter);
	bean.addUrlPatterns("/*");
	bean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,*.font,/druid/*");
	return bean;
}
 
開發者ID:mazhaoyong,項目名稱:api-server-seed,代碼行數:13,代碼來源:WebConfig.java

示例13: FilterRegistrationBean

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean()
FilterRegistrationBean FilterRegistrationBean() {
    final FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
    filterRegistrationBean.setFilter(new DelegatingFilterProxy("springSecurityFilterChain"));
    filterRegistrationBean.setName("springSecurityFilterChain");
    filterRegistrationBean.addUrlPatterns("/api/*");
    return filterRegistrationBean;
}
 
開發者ID:tvajjala,項目名稱:interview-preparation,代碼行數:9,代碼來源:WebSecurityConfig.java

示例14: noHttpSessionFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
FilterRegistrationBean noHttpSessionFilter() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new NoHttpSessionFilter());
    registration.addUrlPatterns("/*");
    return registration;
}
 
開發者ID:AusDTO,項目名稱:spring-security-stateless,代碼行數:8,代碼來源:AppConfig.java

示例15: httpsOnlyFilter

import org.springframework.boot.context.embedded.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
FilterRegistrationBean httpsOnlyFilter() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new HttpsOnlyFilter());
    registration.addUrlPatterns("/*");
    return registration;
}
 
開發者ID:AusDTO,項目名稱:spring-security-stateless,代碼行數:8,代碼來源:AppConfig.java


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