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


Java FilterRegistrationBean.setFilter方法代碼示例

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


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

示例1: responseHeadersSecurityFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@RefreshScope
@Bean
public FilterRegistrationBean responseHeadersSecurityFilter() {
    final HttpWebRequestProperties.Header header = casProperties.getHttpWebRequest().getHeader();
    final Map<String, String> initParams = new HashMap<>();
    initParams.put("enableCacheControl", BooleanUtils.toStringTrueFalse(header.isCache()));
    initParams.put("enableXContentTypeOptions", BooleanUtils.toStringTrueFalse(header.isXcontent()));
    initParams.put("enableStrictTransportSecurity", BooleanUtils.toStringTrueFalse(header.isHsts()));
    initParams.put("enableXFrameOptions", BooleanUtils.toStringTrueFalse(header.isXframe()));
    initParams.put("enableXSSProtection", BooleanUtils.toStringTrueFalse(header.isXss()));
    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new ResponseHeadersEnforcementFilter());
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setInitParameters(initParams);
    bean.setName("responseHeadersSecurityFilter");
    bean.setAsyncSupported(true);
    return bean;

}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:20,代碼來源:CasFiltersConfiguration.java

示例2: delegatingFilterProxy

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean delegatingFilterProxy(){
    FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
    DelegatingFilterProxy proxy = new DelegatingFilterProxy();
    proxy.setTargetFilterLifecycle(true);
    proxy.setTargetBeanName("shiroFilter");
    filterRegistrationBean.setFilter(proxy);
    return filterRegistrationBean;
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:10,代碼來源:ShiroConfiguration.java

示例3: filterRegistrationBean

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean filterRegistrationBean() {
    FilterRegistrationBean registrationBean = new FilterRegistrationBean();
    registrationBean.setUrlPatterns(Collections.singletonList("/*"));
    registrationBean.setFilter(new OpenSessionInViewFilter());
    return registrationBean;
}
 
開發者ID:mingzuozhibi,項目名稱:mzzb-server,代碼行數:8,代碼來源:ServletConfig.java

示例4: 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

示例5: requestEncodingFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean requestEncodingFilterRegistration() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(requestEncodingFilter());
    registration.addUrlPatterns("/*");
    registration.addInitParameter("encoding", "UTF-8");
    registration.setName("RequestEncodingFilter");
    registration.setOrder(4);
    return registration;
}
 
開發者ID:airsonic,項目名稱:airsonic,代碼行數:11,代碼來源:Application.java

示例6: createOpContextFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean createOpContextFilter(@Autowired OperationContext operationContext) {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new OpContextFilter(operationContext));
    registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
    return registration;
}
 
開發者ID:kloiasoft,項目名稱:eventapis,代碼行數:8,代碼來源:EventApisFactory.java

示例7: filterRegistrationBean

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
/**
 * 注冊shiroFilter
 */
@Bean
public FilterRegistrationBean filterRegistrationBean(){
	FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
	filterRegistration.setFilter(new DelegatingFilterProxy("shiroFilter"));
	// 該值缺省為false,表示生命周期有SpringApplicationContext管理,設置為true則表示由ServletContainer管理
	filterRegistration.addInitParameter("targetFilterLifecycle", "true");
	filterRegistration.setEnabled(true);
	filterRegistration.addUrlPatterns("/*"); 
	return filterRegistration;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:14,代碼來源:ShiroConfig.java

示例8: filterRegistrationBean

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean filterRegistrationBean() {
	CharacterEncodingFilter filter = new CharacterEncodingFilter();
	filter.setEncoding("UTF-8");

	FilterRegistrationBean registrationBean = new FilterRegistrationBean();
	registrationBean.setFilter(filter);
	registrationBean.addUrlPatterns("/*");
	return registrationBean;
}
 
開發者ID:noveogroup-amorgunov,項目名稱:spring-mvc-react,代碼行數:11,代碼來源:SpringWebConfig.java

示例9: casClientInfoLoggingFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean casClientInfoLoggingFilter() {
    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new ClientInfoThreadLocalFilter());
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setName("CAS Client Info Logging Filter");
    bean.setAsyncSupported(true);
    return bean;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:10,代碼來源:CasManagementAuditConfiguration.java

示例10: characterEncodingFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@RefreshScope
@Bean
public FilterRegistrationBean characterEncodingFilter() {
    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new CharacterEncodingFilter(
            casProperties.getHttpWebRequest().getWeb().getEncoding(),
            casProperties.getHttpWebRequest().getWeb().isForceEncoding()));
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setName("characterEncodingFilter");
    bean.setAsyncSupported(true);
    return bean;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:13,代碼來源:CasFiltersConfiguration.java

示例11: jerseyFilterRegistration

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
/**
 * Register the Jersey filter
 */
@Bean
public FilterRegistrationBean jerseyFilterRegistration(
		javax.ws.rs.core.Application eurekaJerseyApp) {
	FilterRegistrationBean bean = new FilterRegistrationBean();
	bean.setFilter(new ServletContainer(eurekaJerseyApp));
	bean.setOrder(Ordered.LOWEST_PRECEDENCE);
	bean.setUrlPatterns(
			Collections.singletonList(EurekaConstants.DEFAULT_PREFIX + "/*"));

	return bean;
}
 
開發者ID:dyc87112,項目名稱:didi-eureka-server,代碼行數:15,代碼來源:EurekaServerAutoConfiguration.java

示例12: currentCredentialsAndAuthenticationClearingFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean currentCredentialsAndAuthenticationClearingFilter() {
    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new AuthenticationCredentialsLocalBinderClearingFilter());
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setName("currentCredentialsAndAuthenticationClearingFilter");
    bean.setAsyncSupported(true);
    return bean;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:10,代碼來源:CasFiltersConfiguration.java

示例13: 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

示例14: threadContextMDCServletFilter

import org.springframework.boot.web.servlet.FilterRegistrationBean; //導入方法依賴的package包/類
@Bean
public FilterRegistrationBean threadContextMDCServletFilter() {
    final Map<String, String> initParams = new HashMap<>();
    final FilterRegistrationBean bean = new FilterRegistrationBean();
    bean.setFilter(new ThreadContextMDCServletFilter(ticketRegistrySupport, this.ticketGrantingTicketCookieGenerator));
    bean.setUrlPatterns(Collections.singleton("/*"));
    bean.setInitParameters(initParams);
    bean.setName("threadContextMDCServletFilter");
    bean.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
    return bean;
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:12,代碼來源:CasLoggingConfiguration.java

示例15: someFilterRegistration

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

    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(simpleCORSFilter());
    registration.addUrlPatterns("/*");
    registration.setName("simpleCORSFilter");
    registration.setOrder(1);
    return registration;
}
 
開發者ID:vishal1997,項目名稱:DiscussionPortal,代碼行數:11,代碼來源:DiscussionPortalApplication.java


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