当前位置: 首页>>代码示例>>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;未经允许,请勿转载。