本文整理汇总了Java中org.springframework.boot.context.embedded.FilterRegistrationBean.setOrder方法的典型用法代码示例。如果您正苦于以下问题:Java FilterRegistrationBean.setOrder方法的具体用法?Java FilterRegistrationBean.setOrder怎么用?Java FilterRegistrationBean.setOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.context.embedded.FilterRegistrationBean
的用法示例。
在下文中一共展示了FilterRegistrationBean.setOrder方法的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;
}
示例2: 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;
}
示例3: corsFilter
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
/**
* Enables CORS
*
* @return
*/
@Bean
public FilterRegistrationBean corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
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;
}
示例4: corsFilter
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
/**
* Enables CORS
*
* @return
*/
@Bean
public FilterRegistrationBean corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
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;
}
示例5: corsFilter
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
/**
*
* This allows access to the REST interface from client web code served up by a
* different URL than this one, i.e. cross-site scripting.
*
* http://stackoverflow.com/questions/31724994/spring-data-rest-and-cors
* http://stackoverflow.com/a/31748398/122441 until https://jira.spring.io/browse/DATAREST-573
* @return
*/
@Bean
public FilterRegistrationBean corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("OPTIONS");
config.addAllowedMethod("HEAD");
config.addAllowedMethod("GET");
config.addAllowedMethod("PUT");
config.addAllowedMethod("POST");
config.addAllowedMethod("DELETE");
config.addAllowedMethod("PATCH");
source.registerCorsConfiguration("/**", config);
// return new CorsFilter(source);
final FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
bean.setOrder(0);
return bean;
}
示例6: threadLocalFilter
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean threadLocalFilter() {
Filter filter = new MDCServletFilter();
FilterRegistrationBean registration = new FilterRegistrationBean(filter);
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
registration.setName(MDCServletFilter.class.getSimpleName());
return registration;
}
示例7: corsFilter
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean corsFilter()
{
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new CORSFilter());
filterRegistrationBean.setDispatcherTypes(DispatcherType.REQUEST);
filterRegistrationBean.setUrlPatterns(Arrays.asList("/*"));
filterRegistrationBean.setOrder(Integer.MIN_VALUE + 1000);
return filterRegistrationBean;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: filterRegistrationBean
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean filterRegistrationBean() {
final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
final StrutsPrepareAndExecuteFilter struts = new StrutsPrepareAndExecuteFilter();
registrationBean.setFilter(struts);
registrationBean.setOrder(1);
return registrationBean;
}
示例12: mdcLoggingFilter
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean mdcLoggingFilter() {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new MDCLoggingFilter());
bean.setOrder(1);
return bean;
}
示例13: oauth2ClientFilterRegistration
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
protected FilterRegistrationBean oauth2ClientFilterRegistration(
OAuth2ClientContextFilter filter) {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(filter);
//register it with a sufficiently low order that it comes before the main Spring Security filter.
//In this way we can use it to handle redirects signaled by exceptions in authentication requests.
registration.setOrder(-100);
return registration;
}
示例14: oauth2ClientFilterRegistration
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
protected FilterRegistrationBean oauth2ClientFilterRegistration(OAuth2ClientContextFilter filter)
{
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(filter);
registration.setOrder(-100);
return registration;
}
示例15: oauth2ClientFilterRegistration
import org.springframework.boot.context.embedded.FilterRegistrationBean; //导入方法依赖的package包/类
@Bean
public FilterRegistrationBean oauth2ClientFilterRegistration(
OAuth2ClientContextFilter filter) {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(filter);
registration.setOrder(-100);
return registration;
}